Improved D-Bus Status() output and documented it a bit

This commit is contained in:
Ingo Ruhnke 2011-03-04 01:00:34 +01:00
parent 6c5d485948
commit 5ae17b01cd
5 changed files with 181 additions and 65 deletions

81
TODO
View file

@ -39,16 +39,14 @@ $ sudo pbuilder --build --basetgz /var/cache/pbuilder/base-lucid.tgz ../xboxdrv_
$ dput my-ppa ../xboxdrv_0.7.2-1~lucid1_source.changes
Stuff to do before 0.8.0 release:
Stuff to do before 0.7.2 release:
=================================
== Generic ==
* use -m for --modifier not for --mouse
* document that Xbox360 wireless controller shuts down at 15min
* added glib and dbus dependencies to .deb control file
* add glib and dbus dependencies to .deb control file
* mimic-xpad is broken, should handle wireless and wired controllers
different (different names) or maybe two different options
@ -63,48 +61,18 @@ Stuff to do before 0.8.0 release:
== Device Name ==
* don't use "--name", let --device-name accept a simple string
-> doesn't really work, runs into in-band-signaling issues
-> use:
--device-name STRING
--device-names "0=STRING,1=STRING2"
* ini parser can't handle: device-name=0="Xbox 360 Wireless Receiver",
fails at the first space, so the trouble isn't the second '=', but
just a space INIParser::get_value()
* add --device-usbid TYPE.SLOT=VENDOR:PRODUCT:VERSION (to set uinput properties)
* allow setting a --default-name from which all other controller names
are derived
== D-Bus ==
* swap/assign controller slots via dbus
* document the Dbus interface and extent it where needed
* implement Options::set_device_usbid() and CommandLineParser::set_device_usbid()
== Other ==
* give proper exit code when no controller is found
* factory must create four wireless controllers for each wireless USB device (done -> verify)
* sort options a bit more between global ones, slot local ones and
config local ones
* BTN_A@joystick.1 doesn't work for a single joystick, why? (joystick isn't id=0, why?)
* in INI files should allow:
[xboxdrv]
ui-buttonmap = A=BTN_A,B=BTN_B,...
- in general cleanup config handling, turn almost everything into
proper functions and use the same functions for both cmdline and ini
* improve output on which uinput devices are created (even with udev
there doesn't seem to be a bullet proof way to detect what gets
created)
@ -123,19 +91,6 @@ Stuff to do before 0.8.0 release:
* improve output in daemon mode, when --quiet is not given print the
number of allocated controller slots
* how exactly does daemon interact with wireless pads?!
-> it doesn't, only used the first gamepad or the one given by --wid
-> either use all, allow an option to say how many to use
-> launch listener threads on each port, but only 'activate' the
slot when the controller is connected
* after every thread cleanup, do an enumeration over all USB devices,
find those not currently used by a Slot and recreate them, this
should fix resume issues, this would also fix the issue with
ignoring controllers when all slots are full
-> bad idea, as it would let unused controllers slip into the free slots
* check how daemon reacts on suspend
- suspending the computer leads to LIBUSB_ERROR_IO, unplugging the
controller leads to LIBUSB_ERROR_OTHER
@ -154,6 +109,14 @@ Stuff to do before 0.8.0 release:
== Unsolved/WontFix ==
* after every thread cleanup, do an enumeration over all USB devices,
find those not currently used by a Slot and recreate them, this
should fix resume issues, this would also fix the issue with
ignoring controllers when all slots are full
-> bad idea, as it would let unused controllers slip into the free
slots, could lead to unexpected behaviour
* allow multiple controllers in non-daemon mode
-> not a good idea, complicates stuff and duplicates code
@ -162,6 +125,28 @@ Stuff to do before 0.8.0 release:
results in confusing behaviour
== D-Bus ==
* interface for next release:
Daemon/GetControllerSlotCount -> INT // do we need those or can
Daemon/GetControllerCount -> INT // directories be browsed?
* in INI files should allow:
[xboxdrv]
ui-buttonmap = A=BTN_A,B=BTN_B,...
- in general cleanup config handling, turn almost everything into
proper functions and use the same functions for both cmdline and ini
* allow setting a --default-name from which all other controller names
are derived
-> already there in the form of auto.auto?
-> No, as those don't derive the name, but set a fixed one
* allow swap/assign of controller to slots via dbus
* do modifier/filter dump when --verbose is given, make verbose
overall more useful

View file

@ -5,7 +5,7 @@
\\$2 \(la\\$1\(ra\\$3
..
.if \n(.g .mso www.tmac
.TH "xboxdrv " 1 2010-05-05 0.7.1 "User Commands"
.TH "xboxdrv " 1 2010-05-05 0.7.2 "User Commands"
.SH NAME
xboxdrv
\- A Xbox/Xbox360 gamepad driver that works in userspace
@ -651,8 +651,8 @@ a full list of possible modifier.
Specify the number of miliseconds that xboxdrv will wait
for events from the controller before moving on and
processing things like auto-fire or relative-axis.
Default value is 25, smaller values will give you a
higher resoultion auto fire, but will waste some more
Default value is 10, smaller values will give you a
higher resoultion auto fire and relative event movement, but will waste some more
CPU.
.TP
\*(T<\fB\-b, \-\-buttonmap BUTTON=BUTTON,...\fR\*(T>
@ -754,7 +754,7 @@ their range is different.
Just like with \*(T<\fB\-\-ui\-axismap\fR\*(T> you can add axis filter to each axis.
.SS "MODIFIER PRESET CONFIGURATION OPTIONS"
The options in this sections are sortcuts
for \*(T<\fB\-\-modifier\fR\*(T>.
for \*(T<\fB\-\-modifier\fR\*(T> options.
Unlike \*(T<\fB\-\-modifier\fR\*(T> they are not order
depended, but have a predefined order that is used no matter
the order in which the options are given.
@ -1352,6 +1352,16 @@ other, so order is important.
\*(T<\fBdpad\-rotate\fR\*(T>=\fIDEGREE\fR
See \*(T<\fB\-\-dpad\-rotation\fR\*(T>.
.TP
\*(T<\fBdpad\-restrictor\fR\*(T>=\fIRESTRICTON\fR
Restricts the dpad movement, values
for \fIRESTRICTON\fR can be:
x-axis: only allow movement in the X axis
y-axis: only allow movement in the Y axis
fourway: allow movement in X and Y axis, but filter out diagonals
.TP
\*(T<\fB4wayrest\fR\*(T>, \*(T<\fBfour\-way\-restrictor\fR\*(T>=\fIXAXIS\fR:\fIYAXIS\fR
See \*(T<\fB\-\-four\-way\-restrictor\fR\*(T>.
.TP
@ -1503,6 +1513,55 @@ it you can write its pid via the \*(T<\fB\-\-pid\-file\fR\*(T>:
.nf
\*(T<$ sudo xboxdrv \-\-daemon \-\-detach \-\-pid\-file /var/run/xboxdrv.pid\*(T>
.fi
.SH "XBOXDRV DAEMON DBUS INTERFACE"
When Xboxdrv is run as daemon it will export some API functions
via D-Bus, thus allowing to make configuration changes at
runtime. The D-Bus interface can be accessed either by the
numerous language bindings provided or via the command line tool
\fBdbus-send\fR:
.PP
Introspection is provided via the usual means:
.PP
.nf
\*(T<dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv org.freedesktop.DBus.Introspectable.Introspect
dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.freedesktop.DBus.Introspectable.Introspect
dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/Daemon org.freedesktop.DBus.Introspectable.Introspect\*(T>
.fi
.PP
Status information on available slots, configuration and active controllers can be obtained via:
.PP
.nf
\*(T<dbus\-send \e
\-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/Daemon org.seul.Xboxdrv.Daemon.Status\*(T>
.fi
.PP
Setting the LED on controller 0 can be done via:
.PP
.nf
\*(T<dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetLed int32:4\*(T>
.fi
.PP
Setting the rumble motors on controller 0 can be done via:
.PP
.nf
\*(T<dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetRumble int32:255 int32:255\*(T>
.fi
.PP
Setting a specific controller slot configuration, just
as \*(T<\fB\-\-toggle BTN\fR\*(T> allows, can be done with:
.PP
.nf
\*(T<dbus\-send \-\-session \-\-type=method_call \-\-print\-reply \e
\-\-dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetConfig int32:2\*(T>
.fi
.SH TESTING
Knowing how to test a xboxdrv configuration is absolutely crucial in
understanding what is wrong in a given setup. Testing the
@ -1567,6 +1626,10 @@ If the tools provide no output at all, this might not be due to a
wrong configuration, but due to Xorg grabbing your event device and
locking it, see Xorg section for possible fixes.
.SH EXAMPLES
The configurations below are just a few random examples, further
examples can be found in the \*(T<\fIexamples/\fR\*(T>
directory of the xboxdrv source tree or
in \*(T<\fI/usr/share/doc/xboxdrv/examples/\fR\*(T>.
.SS "TURNING TRIGGERS INTO BUTTONS"
By default xboxdrv will handle the trigger as analog axis, not
buttons, while this is beneficial for racing games, it will

View file

@ -2191,6 +2191,54 @@ $ modprobe joydev]]></programlisting>
</refsect2>
</refsect1>
<refsect1>
<title>Xboxdrv Daemon Dbus Interface</title>
<para>
When Xboxdrv is run as daemon it will export some API functions
via D-Bus, thus allowing to make configuration changes at
runtime. The D-Bus interface can be accessed either by the
numerous language bindings provided or via the command line tool
<command>dbus-send</command>:
</para>
<para>
Introspection is provided via the usual means:
</para>
<programlisting><![CDATA[dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv org.freedesktop.DBus.Introspectable.Introspect
dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.freedesktop.DBus.Introspectable.Introspect
dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/Daemon org.freedesktop.DBus.Introspectable.Introspect]]></programlisting>
<para>
Status information on available slots, configuration and active controllers can be obtained via:
</para>
<programlisting><![CDATA[dbus-send \
--session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/Daemon org.seul.Xboxdrv.Daemon.Status]]></programlisting>
<para>
Setting the LED on controller 0 can be done via:
</para>
<programlisting><![CDATA[dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetLed int32:4]]></programlisting>
<para>
Setting the rumble motors on controller 0 can be done via:
</para>
<programlisting><![CDATA[dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetRumble int32:255 int32:255]]></programlisting>
<para>
Setting a specific controller slot configuration, just
as <option>--toggle BTN</option> allows, can be done with:
</para>
<programlisting><![CDATA[dbus-send --session --type=method_call --print-reply \
--dest=org.seul.Xboxdrv /org/seul/Xboxdrv/ControllerSlots/0 org.seul.Xboxdrv.Controller.SetConfig int32:2]]></programlisting>
</refsect1>
<refsect1>
<title>Testing</title>
<para>
@ -2302,6 +2350,12 @@ $ modprobe joydev]]></programlisting>
<refsect1>
<title>Examples</title>
<para>
The configurations below are just a few random examples, further
examples can be found in the <filename>examples/</filename>
directory of the xboxdrv source tree or
in <filename>/usr/share/doc/xboxdrv/examples/</filename>.
</para>
<refsect2>
<title>Turning triggers into buttons</title>

View file

@ -47,6 +47,7 @@ public:
void set_rumble(uint8_t lhs, uint8_t rhs);
void set_ff_callback(const boost::function<void (uint8_t, uint8_t)>& callback);
void set_config(int num);
ControllerSlotConfigPtr get_config() const { return m_config; }
private:
UInputMessageProcessor(const UInputMessageProcessor&);

View file

@ -875,30 +875,43 @@ XboxdrvDaemon::status()
{
std::ostringstream out;
out << "slots: " << m_controller_slots.size() << std::endl;
out << "inactive controller: " << m_inactive_threads.size() << std::endl;
out << "slots: " << std::endl;
out << boost::format("SLOT STATUS CONFIG USBID USBPATH NAME\n");
for(ControllerSlots::iterator i = m_controller_slots.begin(); i != m_controller_slots.end(); ++i)
{
out << "slot: ";
if ((*i)->is_connected())
if ((*i)->get_thread())
{
out << (*i)->get_thread()->get_name() << std::endl;
int config_count = -1;
int current_config = -1;
if (UInputMessageProcessor* msg_proc
= dynamic_cast<UInputMessageProcessor*>((*i)->get_thread()->get_message_proc()))
{
current_config = msg_proc->get_config()->get_current_config();
config_count = msg_proc->get_config()->config_count();
}
out << boost::format("%4d %6s %3d/%-2d %5s %7s %s\n")
% (i - m_controller_slots.begin())
% " ok "
% (current_config+1) % config_count
% (*i)->get_thread()->get_usbid()
% (*i)->get_thread()->get_usbpath()
% (*i)->get_thread()->get_name();
}
else
{
out << "<inactive>" << std::endl;
out << boost::format("%4d empty\n")
% (i - m_controller_slots.begin());
}
}
out << std::endl;
}
out << "inactive: " << std::endl;
for(Threads::iterator i = m_inactive_threads.begin(); i != m_inactive_threads.end(); ++i)
{
out << "controller: " << (*i)->get_name() << std::endl;
out << boost::format(" - %5s %7s %s\n")
% (*i)->get_usbid()
% (*i)->get_usbpath()
% (*i)->get_name();
}
out << std::endl;
return out.str();
}