summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hlusiak <saschahlusiak@arcor.de>2008-10-01 21:43:49 +0200
committerSascha Hlusiak <saschahlusiak@arcor.de>2008-10-01 21:43:49 +0200
commit3c2a323a3a14bc27a7a5d9f4470b4abd83c424ec (patch)
tree422a2313989dae08fd3cc9f35d6cae2197f92df3
parent432805db42b1f7d69131406c8b58571d224e1c47 (diff)
Option for per-axis valuators. Defaults to off for all axes.
Old: Each axis had an extra valuator, starting with 2 (0 and 1 are pointer movement) New: Add "valuator" to axis option to give it an extra valuator of range -32768 to 32768. Default: Off for all axes, since rarely used (and broken anyway right now).
-rw-r--r--man/joystick.man21
-rw-r--r--src/jstk.c9
-rw-r--r--src/jstk_options.c4
3 files changed, 20 insertions, 14 deletions
diff --git a/man/joystick.man b/man/joystick.man
index 121d005..2b72da7 100644
--- a/man/joystick.man
+++ b/man/joystick.man
@@ -128,6 +128,16 @@ Every axis which's mode is not
.B none
will be reported as an additional valuator.
.TP 7
+.B \*qvaluator\*q
+Send extra valuator events for this axis. The valuators will be numbered ascending, starting with 2 (valuator 0 and 1 are reserved for pointer movement). The range of the valuators is always
+.IR -32767 " to " 32768 .
+Neither
+.B mode
+nor
+.B axis
+needs to be set to generate extra valuator events.
+Default: not set.
+.TP 7
.BI "\*qaxis="[<factor>]<axis> \*q
Where
.I <axis>
@@ -303,17 +313,6 @@ and the second and fourth axis to the arrow keys
The keys for the first two axes will be generated in an interval according to the value of the axis. The autorepeat speed of the first axis will be half the speed of that of the second axis.
The keys for the third and fourth axis are generated once when the axis moves out of the deadzone and when it moves back into the deadzone. X.Org will autorepeat those keys according to current keyboard settings.
-.SH "VALUATORS"
-The driver reports relative cursor movement as valuators 0 and 1.
-
-Every axis will be associated with an additional valuator,
-reporting the absolute raw values of the axis in the range of
-.IR "-32768 " to " 32768" .
-
-Axes in the mode
-.B "\*qnone\*q"
-will be ignored. The mode has no effect on the reported value. The axis does not need to be assigned to a direction.
-
.SH "NOTES"
The driver does not do hotplugging on it's own. The joystick needs to be plugged in when the driver is loaded.
If the joystick is unplugged, the device will be automatically deactivated.
diff --git a/src/jstk.c b/src/jstk.c
index b8b58ab..e749b8d 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -364,8 +364,11 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
m = 2;
for (i=0; i<MAXAXES; i++)
- if (priv->axis[i].type != TYPE_NONE)
- priv->axis[i].valuator = m++;
+ if (priv->axis[i].valuator != -1)
+ {
+ DBG(3, ErrorF("Axis %d will be valuator %d\n", i, m));
+ priv->axis[i].valuator = m++;
+ }
if (InitValuatorClassDeviceStruct(pJstk,
m,
@@ -392,7 +395,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
0, /* min_res */
1); /* max_res */
for (i=0; i<MAXAXES; i++)
- if (priv->axis[i].type != TYPE_NONE)
+ if (priv->axis[i].valuator != -1)
{
InitValuatorAxisStruct(pJstk,
priv->axis[i].valuator,
diff --git a/src/jstk_options.c b/src/jstk_options.c
index d0e5769..c7b4722 100644
--- a/src/jstk_options.c
+++ b/src/jstk_options.c
@@ -255,6 +255,10 @@ jstkParseAxisOption(const char* org,
name);
}
+ if ((tmp = strstr(param, "valuator")) != NULL ) {
+ axis->valuator = 0; /* Will be renumbered appropriately on DEVICE_INIT */
+ }
+
if ((tmp = strstr(param, "keylow=")) != NULL) {
if (sscanf(tmp, "keylow=%30s", p) == 1) {
char *current, *next;