Added --mouse and documentation
This commit is contained in:
parent
452f724cd5
commit
26dd8d20f2
5 changed files with 63 additions and 41 deletions
4
TODO
4
TODO
|
@ -19,8 +19,6 @@ git push --tags
|
|||
Stuff to do before 0.5 release:
|
||||
===============================
|
||||
|
||||
* add --mouse that gives a usable mouse keyboard emulation
|
||||
|
||||
* split xboxdrv-daemon into a separate .deb package
|
||||
|
||||
* version number needs to be centralized, its currently in the man
|
||||
|
@ -37,6 +35,8 @@ Stuff to do before 0.5 release:
|
|||
|
||||
--ui-axismap x1=REL_X:10:20,y1=REL_Y:10:20,y2
|
||||
|
||||
-> caused by flooding the device with to many events it seems
|
||||
|
||||
* src/xbox_controller.cpp:71: Make endpoint variable
|
||||
http://ubuntuforums.org/showthread.php?p=7538167#post7538167
|
||||
|
||||
|
|
|
@ -427,7 +427,9 @@ to \*(T<\fB\-\-ui\-buttonmap\fR\*(T> to allow shifting:
|
|||
|
||||
In this example LB acts as shift button, if A is pressed
|
||||
without LB it will send out a JS_0 event, but if LB is
|
||||
pressed it will send a JS_2 event instead.
|
||||
pressed it will send a JS_2 event instead. This allows
|
||||
you to multiply the number of available buttons on the
|
||||
controller.
|
||||
|
||||
See the section KEYBOARD EMULATION below on how to
|
||||
resolve issues with Xorg not detecting the virtual
|
||||
|
@ -464,12 +466,25 @@ Removes all uinput mappings and will leave the driver in
|
|||
a blank state and only map those things you added
|
||||
yourself. If you only want to get rid of individual
|
||||
buttons you can use the 'void' event:
|
||||
.TP
|
||||
\*(T<\fB\-\-mouse\fR\*(T>
|
||||
Lets the controller act as a mouse. It is indendical to:
|
||||
|
||||
.nf
|
||||
\*(T<% xboxdrv \e
|
||||
\-\-ui\-buttonmap tr=void,tl=void,lb=void,rb=void \e
|
||||
\-\-ui\-axismap x2=void,y2=void,rt=void,lt=void,dpad_x=void,dpad_y=void\*(T>
|
||||
\-\-dpad\-as\-button
|
||||
\-\-deadzone 4000
|
||||
\-\-trigger\-as\-zaxis
|
||||
\-\-axismap "\-y2=y2,\-trigger=trigger"
|
||||
\-\-ui\-axismap "x1=REL_X:15:20,y1=REL_Y:15:20,y2=REL_WHEEL:5:100,x2=REL_HWHEEL:5:100,trigger=REL_WHEEL:5:100"
|
||||
\-\-ui\-buttonmap "a=BTN_LEFT,b=BTN_RIGHT,x=BTN_MIDDLE,y=KEY_ENTER,rb=KEY_PAGEDOWN,lb=KEY_PAGEUP,"
|
||||
\-\-ui\-buttonmap "dl=KEY_LEFT,dr=KEY_RIGHT,du=KEY_UP,dd=KEY_DOWN,"
|
||||
\-\-ui\-buttonmap "start=KEY_FORWARD,back=KEY_BACK,guide=KEY_ESC,tl=void,tr=void"\*(T>
|
||||
.fi
|
||||
|
||||
And you can customize is by the usal means, just make
|
||||
sure that \*(T<\fB\-\-mouse\fR\*(T> comes before you
|
||||
customization options on the command line.
|
||||
.TP
|
||||
\*(T<\fB\-\-name DEVNAME\fR\*(T>
|
||||
Changes the descriptive name the device will have
|
||||
|
@ -760,22 +775,7 @@ 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
|
||||
.SS "MOUSE EMULATION"
|
||||
Mouse emulation can be done with something like this:
|
||||
.PP
|
||||
.nf
|
||||
\*(T<% ./xboxdrv \e
|
||||
\-\-axismap \-y2=y2 \e
|
||||
\-\-ui\-axismap x1=REL_X,y1=REL_Y,y2=REL_WHEEL:3:50 \e
|
||||
\-\-ui\-buttonmap a=BTN_LEFT,b=BTN_RIGHT,x=BTN_MIDDLE,y=KEY_ENTER \e
|
||||
\-\-ui\-buttonmap rb=KEY_FORWARD,lb=KEY_BACK \e
|
||||
\-\-ui\-buttonmap dl=KEY_LEFT,dr=KEY_RIGHT,du=KEY_UP,dd=KEY_DOWN \e
|
||||
\-s \-\-deadzone 5000 \-\-dpad\-as\-button\*(T>
|
||||
.fi
|
||||
.PP
|
||||
This will map the dpad to cursor keys, left analogstick to mouse
|
||||
cursor and right analogstick to mouse wheel.
|
||||
.PP
|
||||
.SS
|
||||
Note that if you have your mouse buttons switched you must
|
||||
adjust the above to match your mouse configuration or the
|
||||
button events will come out wrong.
|
||||
|
|
|
@ -611,10 +611,29 @@
|
|||
yourself. If you only want to get rid of individual
|
||||
buttons you can use the 'void' event:
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--mouse</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Lets the controller act as a mouse. It is indendical to:
|
||||
</para>
|
||||
<programlisting><![CDATA[% xboxdrv \
|
||||
--ui-buttonmap tr=void,tl=void,lb=void,rb=void \
|
||||
--ui-axismap x2=void,y2=void,rt=void,lt=void,dpad_x=void,dpad_y=void]]></programlisting>
|
||||
--dpad-as-button
|
||||
--deadzone 4000
|
||||
--trigger-as-zaxis
|
||||
--axismap "-y2=y2,-trigger=trigger"
|
||||
--ui-axismap "x1=REL_X:15:20,y1=REL_Y:15:20,y2=REL_WHEEL:5:100,x2=REL_HWHEEL:5:100,trigger=REL_WHEEL:5:100"
|
||||
--ui-buttonmap "a=BTN_LEFT,b=BTN_RIGHT,x=BTN_MIDDLE,y=KEY_ENTER,rb=KEY_PAGEDOWN,lb=KEY_PAGEUP,"
|
||||
--ui-buttonmap "dl=KEY_LEFT,dr=KEY_RIGHT,du=KEY_UP,dd=KEY_DOWN,"
|
||||
--ui-buttonmap "start=KEY_FORWARD,back=KEY_BACK,guide=KEY_ESC,tl=void,tr=void"]]></programlisting>
|
||||
<para>
|
||||
And you can customize is by the usal means, just make
|
||||
sure that <option>--mouse</option> comes before you
|
||||
customization options on the command line.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -1001,24 +1020,6 @@ pos = (1.0f - (1.0f - pos) ** t) ** (1 / t);]]></programlisting>
|
|||
<refsect1>
|
||||
<title>EXAMPLES</title>
|
||||
<refsect2>
|
||||
<title>Mouse Emulation</title>
|
||||
<para>
|
||||
Mouse emulation can be done with something like this:
|
||||
</para>
|
||||
|
||||
<programlisting><![CDATA[% ./xboxdrv \
|
||||
--axismap -y2=y2 \
|
||||
--ui-axismap x1=REL_X,y1=REL_Y,y2=REL_WHEEL:3:50 \
|
||||
--ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,x=BTN_MIDDLE,y=KEY_ENTER \
|
||||
--ui-buttonmap rb=KEY_FORWARD,lb=KEY_BACK \
|
||||
--ui-buttonmap dl=KEY_LEFT,dr=KEY_RIGHT,du=KEY_UP,dd=KEY_DOWN \
|
||||
-s --deadzone 5000 --dpad-as-button]]></programlisting>
|
||||
|
||||
<para>
|
||||
This will map the dpad to cursor keys, left analogstick to mouse
|
||||
cursor and right analogstick to mouse wheel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that if you have your mouse buttons switched you must
|
||||
adjust the above to match your mouse configuration or the
|
||||
|
|
|
@ -76,6 +76,7 @@ enum {
|
|||
OPTION_LIST_SUPPORTED_DEVICES,
|
||||
OPTION_LIST_SUPPORTED_DEVICES_XPAD,
|
||||
OPTION_LIST_CONTROLLER,
|
||||
OPTION_MOUSE,
|
||||
OPTION_HELP_DEVICES
|
||||
};
|
||||
|
||||
|
@ -163,6 +164,7 @@ CommandLineOptions::CommandLineOptions() :
|
|||
.add_option(OPTION_UI_CLEAR, 0, "ui-clear", "", "Removes all existing uinput bindings")
|
||||
.add_option(OPTION_UI_BUTTONMAP, 0, "ui-buttonmap", "MAP", "Changes the uinput events send when hitting a button (example: X=BTN_Y,A=KEY_A)")
|
||||
.add_option(OPTION_UI_AXISMAP, 0, "ui-axismap", "MAP", "Changes the uinput events send when moving a axis (example: X1=ABS_X2)")
|
||||
.add_option(OPTION_MOUSE, 0, "mouse", "", "Enable mouse emulation")
|
||||
.add_option(OPTION_SQUARE_AXIS, 0, "square-axis", "", "Cause the diagonals to be reported as (1,1) instead of (0.7, 0.7)")
|
||||
.add_option(OPTION_FOUR_WAY_RESTRICTOR,0, "four-way-restrictor", "", "Restrict axis movement to one axis at a time")
|
||||
.add_option(OPTION_DPAD_ROTATION, 0, "dpad-rotation", "DEGREE", "Rotate the dpad by the given DEGREE, must be a multiple of 45")
|
||||
|
@ -384,6 +386,23 @@ CommandLineOptions::parse_args(int argc, char** argv)
|
|||
arg2apply(opt.argument, boost::bind(&set_ui_button_map, boost::ref(opts.uinput_config.btn_map), _1));
|
||||
break;
|
||||
|
||||
case OPTION_MOUSE:
|
||||
opts.uinput_config.dpad_as_button = true;
|
||||
opts.deadzone = 4000;
|
||||
opts.uinput_config.trigger_as_zaxis = true;
|
||||
arg2vector("-y2=y2,-trigger=trigger", opts.axis_map, &AxisMapping::from_string);
|
||||
// send events only every 20msec, lower values cause a jumpy pointer
|
||||
arg2apply("x1=REL_X:15:20,y1=REL_Y:15:20,"
|
||||
"y2=REL_WHEEL:5:100,x2=REL_HWHEEL:5:100,"
|
||||
"trigger=REL_WHEEL:5:100",
|
||||
boost::bind(&set_ui_axis_map, opts.uinput_config.axis_map, _1));
|
||||
arg2apply("a=BTN_LEFT,b=BTN_RIGHT,x=BTN_MIDDLE,y=KEY_ENTER,rb=KEY_PAGEDOWN,lb=KEY_PAGEUP,"
|
||||
"dl=KEY_LEFT,dr=KEY_RIGHT,du=KEY_UP,dd=KEY_DOWN,"
|
||||
"start=KEY_FORWARD,back=KEY_BACK,guide=KEY_ESC,"
|
||||
"tl=void,tr=void",
|
||||
boost::bind(&set_ui_button_map, boost::ref(opts.uinput_config.btn_map), _1));
|
||||
break;
|
||||
|
||||
case OPTION_ID:
|
||||
opts.controller_id = boost::lexical_cast<int>(opt.argument);
|
||||
break;
|
||||
|
|
|
@ -382,7 +382,9 @@ Xboxdrv::controller_loop(GamepadType type, uInput* uinput, XboxGenericController
|
|||
}
|
||||
|
||||
if (uinput)
|
||||
{
|
||||
uinput->update(msec_delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue