Hooked up daemon some more, basic controller stuff now working
This commit is contained in:
parent
ca8c2e28a6
commit
3ca7573177
8 changed files with 69 additions and 50 deletions
22
TODO
22
TODO
|
@ -54,8 +54,24 @@ $ sudo pbuilder --build --basetgz /var/cache/pbuilder/base-lucid.tgz ../xboxdrv-
|
|||
Stuff to do before 0.8.0 release:
|
||||
=================================
|
||||
|
||||
* Modifier::update() needs to be changed, as message updates and time
|
||||
updates are now separate
|
||||
Checklist
|
||||
=========
|
||||
|
||||
* check output when --silent not given
|
||||
|
||||
* check clean shutdown
|
||||
|
||||
* check valgrind
|
||||
|
||||
* check daemon
|
||||
|
||||
* check autofire and other modifier that depend on time
|
||||
|
||||
* test all controller
|
||||
|
||||
* check that the child process works
|
||||
|
||||
* check that uinput gets its timeout/update calls (send_rel_event)
|
||||
|
||||
|
||||
Stuff to do before 0.7.4 release:
|
||||
|
@ -155,6 +171,8 @@ Autolaunch error: X11 initialization failed." failed to open connection to bus:
|
|||
-> add rel-repeat:{repeat} type that repeats more often the more the
|
||||
stick is pressed, to give better scroll wheel emulation
|
||||
|
||||
* add "key-repeat", similar to rel-repeat
|
||||
|
||||
* add "key-once" or something like that, that only clicks a key
|
||||
without keeping it pressed
|
||||
|
||||
|
|
|
@ -20,45 +20,59 @@
|
|||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
ControllerSlot::ControllerSlot() :
|
||||
m_id(),
|
||||
m_config(),
|
||||
m_rules(),
|
||||
m_led_status(-1),
|
||||
m_controller()
|
||||
{}
|
||||
#include "uinput_message_processor.hpp"
|
||||
#include "dummy_message_processor.hpp"
|
||||
|
||||
ControllerSlot::ControllerSlot(int id_,
|
||||
ControllerSlotConfigPtr config_,
|
||||
std::vector<ControllerMatchRulePtr> rules_,
|
||||
int led_status_,
|
||||
ControllerPtr controller_) :
|
||||
const Options& opts,
|
||||
UInput* uinput) :
|
||||
m_id(id_),
|
||||
m_config(config_),
|
||||
m_rules(rules_),
|
||||
m_led_status(led_status_),
|
||||
m_controller(controller_)
|
||||
m_thread(),
|
||||
m_opts(opts),
|
||||
m_uinput(uinput)
|
||||
{}
|
||||
|
||||
void
|
||||
ControllerSlot::connect(ControllerPtr controller)
|
||||
{
|
||||
assert(!m_controller);
|
||||
m_controller = controller;
|
||||
assert(!m_thread);
|
||||
|
||||
m_thread.reset(new ControllerThread(controller, m_opts));
|
||||
|
||||
if (m_uinput)
|
||||
{
|
||||
m_thread->set_message_proc(std::auto_ptr<MessageProcessor>(new UInputMessageProcessor(*m_uinput, m_config, m_opts)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thread->set_message_proc(std::auto_ptr<MessageProcessor>(new DummyMessageProcessor()));
|
||||
}
|
||||
|
||||
m_thread->start();
|
||||
}
|
||||
|
||||
ControllerPtr
|
||||
ControllerSlot::disconnect()
|
||||
{
|
||||
ControllerPtr controller = m_controller;
|
||||
m_controller.reset();
|
||||
assert(m_thread);
|
||||
|
||||
ControllerPtr controller = m_thread->get_controller();
|
||||
m_thread->stop();
|
||||
m_thread.reset();
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
bool
|
||||
ControllerSlot::is_connected() const
|
||||
{
|
||||
return m_controller;
|
||||
return m_thread;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "controller_slot_config.hpp"
|
||||
#include "controller_thread.hpp"
|
||||
#include "controller_ptr.hpp"
|
||||
|
||||
class ControllerSlot
|
||||
{
|
||||
|
@ -32,15 +31,18 @@ private:
|
|||
ControllerSlotConfigPtr m_config;
|
||||
std::vector<ControllerMatchRulePtr> m_rules;
|
||||
int m_led_status;
|
||||
ControllerPtr m_controller;
|
||||
ControllerThreadPtr m_thread;
|
||||
|
||||
const Options& m_opts;
|
||||
UInput* m_uinput;
|
||||
|
||||
public:
|
||||
ControllerSlot();
|
||||
ControllerSlot(int id_,
|
||||
ControllerSlotConfigPtr config_,
|
||||
std::vector<ControllerMatchRulePtr> rules_,
|
||||
int led_status_,
|
||||
ControllerPtr controller = ControllerPtr());
|
||||
const Options& opts,
|
||||
UInput* uinput);
|
||||
|
||||
bool is_connected() const;
|
||||
void connect(ControllerPtr controller);
|
||||
|
@ -51,8 +53,12 @@ public:
|
|||
int get_id() const { return m_id; }
|
||||
ControllerSlotConfigPtr get_config() const { return m_config; }
|
||||
|
||||
ControllerPtr get_controller() const { return m_controller; }
|
||||
ControllerThreadPtr get_thread() const { return ControllerThreadPtr(); }
|
||||
ControllerThreadPtr get_thread() const { return m_thread; }
|
||||
ControllerPtr get_controller() const { return m_thread ? m_thread->get_controller() : ControllerPtr(); }
|
||||
|
||||
private:
|
||||
ControllerSlot(const ControllerSlot&);
|
||||
ControllerSlot& operator=(const ControllerSlot&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,14 +80,12 @@ ControllerThread::on_message(const XboxGenericMsg& msg)
|
|||
void
|
||||
ControllerThread::start()
|
||||
{
|
||||
m_controller->start();
|
||||
m_timeout_id = g_timeout_add(m_timeout, &ControllerThread::on_timeout_wrap, this);
|
||||
}
|
||||
|
||||
void
|
||||
ControllerThread::stop()
|
||||
{
|
||||
m_controller->stop();
|
||||
g_source_remove(m_timeout_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -386,6 +386,7 @@ Xboxdrv::run_main(const Options& opts)
|
|||
print_info(dev, dev_type, opts);
|
||||
|
||||
controller = ControllerFactory::create(dev_type, dev, opts);
|
||||
controller->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "uinput_message_processor.hpp"
|
||||
#include "dummy_message_processor.hpp"
|
||||
#include "helper.hpp"
|
||||
#include "raise_exception.hpp"
|
||||
#include "select.hpp"
|
||||
|
@ -221,7 +219,9 @@ XboxdrvDaemon::init_uinput()
|
|||
m_opts.extra_devices,
|
||||
controller->second),
|
||||
controller->second.get_match_rules(),
|
||||
controller->second.get_led_status())));
|
||||
controller->second.get_led_status(),
|
||||
m_opts,
|
||||
m_uinput.get())));
|
||||
slot_count += 1;
|
||||
}
|
||||
|
||||
|
@ -748,22 +748,6 @@ XboxdrvDaemon::connect(ControllerSlotPtr slot, ControllerPtr controller)
|
|||
log_error("failed to set led: " << err.what());
|
||||
}
|
||||
|
||||
{
|
||||
// connect controller with the current slots message proc
|
||||
// FIXME: Could get rid of MessageProcessor and just use
|
||||
// ControllerSlot?! Or a callback to ControllerSlot.
|
||||
std::auto_ptr<MessageProcessor> message_proc;
|
||||
if (m_uinput.get())
|
||||
{
|
||||
message_proc.reset(new UInputMessageProcessor(*m_uinput, slot->get_config(), m_opts));
|
||||
}
|
||||
else
|
||||
{
|
||||
message_proc.reset(new DummyMessageProcessor());
|
||||
}
|
||||
//FIXME: controller->set_message_proc(message_proc);
|
||||
}
|
||||
|
||||
slot->connect(controller);
|
||||
on_connect(slot);
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
class Options;
|
||||
class UInput;
|
||||
class ControllerThread;
|
||||
class USBGSource;
|
||||
struct XPadDevice;
|
||||
|
||||
|
@ -39,6 +38,7 @@ private:
|
|||
static XboxdrvDaemon* s_current;
|
||||
|
||||
const Options& m_opts;
|
||||
|
||||
struct udev* m_udev;
|
||||
struct udev_monitor* m_monitor;
|
||||
|
||||
|
|
|
@ -72,10 +72,9 @@ xboxdrv_g_controller_set_led(XboxdrvGController* self, int status, GError** erro
|
|||
log_info("D-Bus: xboxdrv_g_controller_set_led(" << self << ", " << status << ")");
|
||||
|
||||
if (self->controller &&
|
||||
self->controller->get_thread() &&
|
||||
self->controller->get_thread()->get_controller())
|
||||
self->controller->get_controller())
|
||||
{
|
||||
self->controller->get_thread()->get_controller()->set_led(status);
|
||||
self->controller->get_controller()->set_led(status);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -92,10 +91,9 @@ xboxdrv_g_controller_set_rumble(XboxdrvGController* self, int strong, int weak,
|
|||
log_info("D-Bus: xboxdrv_g_controller_set_rumble(" << self << ", " << strong << ", " << weak << ")");
|
||||
|
||||
if (self->controller &&
|
||||
self->controller->get_thread() &&
|
||||
self->controller->get_thread()->get_controller())
|
||||
self->controller->get_controller())
|
||||
{
|
||||
self->controller->get_thread()->get_controller()->set_rumble(strong, weak);
|
||||
self->controller->get_controller()->set_rumble(strong, weak);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue