fix previous commit: use pos/neg instead of +/-
This commit is contained in:
@@ -453,10 +453,10 @@ Size=16x2
|
|||||||
Device=/dev/js0
|
Device=/dev/js0
|
||||||
|
|
||||||
# set the axis map
|
# set the axis map
|
||||||
Map_Axis1- = Left
|
Map_Axis1neg=Left
|
||||||
Map_Axis1+ = Right
|
Map_Axis1pos=Right
|
||||||
Map_Axis2- = Up
|
Map_Axis2neg=Up
|
||||||
Map_Axis2+ = Down
|
Map_Axis2pos=Down
|
||||||
|
|
||||||
# set the button map
|
# set the button map
|
||||||
Map_Button1=Enter
|
Map_Button1=Enter
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ This section covers the joystick input driver for LCDd.
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>Map_Axis<replaceable>NUM</replaceable>-=</command>
|
<command>Map_Axis<replaceable>NUM</replaceable>neg=</command>
|
||||||
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
||||||
</term>
|
</term>
|
||||||
<term>
|
<term>
|
||||||
<command>Map_Axis<replaceable>NUM</replaceable>+=</command>
|
<command>Map_Axis<replaceable>NUM</replaceable>pos=</command>
|
||||||
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -39,8 +39,8 @@ This section covers the joystick input driver for LCDd.
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
<replaceable>NUM</replaceable> is an integer starting with <literal>1</literal>
|
<replaceable>NUM</replaceable> is an integer starting with <literal>1</literal>
|
||||||
that represents each axis with the appendices <literal>+</literal> and
|
that represents each axis with the affixes <literal>neg</literal> and
|
||||||
<literal>-</literal> determining the direction.
|
<literal>pos</literal> determining the direction.
|
||||||
The exact numbering of the axes depends on the hardware used.
|
The exact numbering of the axes depends on the hardware used.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
+16
-8
@@ -135,15 +135,21 @@ joy_init (Driver *drvthis)
|
|||||||
char mapkey[50];
|
char mapkey[50];
|
||||||
char *mapval;
|
char *mapval;
|
||||||
|
|
||||||
snprintf(mapkey, sizeof(mapkey), "Map_Axis%d-", i+1);
|
snprintf(mapkey, sizeof(mapkey), "Map_Axis%dneg", i+1);
|
||||||
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
||||||
if (mapval != NULL)
|
if (mapval != NULL) {
|
||||||
p->axismap[2*i] = strdup(mapval);
|
p->axismap[2*i] = strdup(mapval);
|
||||||
|
report(RPT_DEBUG, "%s: map Axis%dneg to %s",
|
||||||
|
drvthis->name, i+1, p->axismap[2*i]);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(mapkey, sizeof(mapkey), "Map_Axis%d+", i+1);
|
snprintf(mapkey, sizeof(mapkey), "Map_Axis%dpos", i+1);
|
||||||
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
||||||
if (mapval != NULL)
|
if (mapval != NULL) {
|
||||||
p->axismap[2*i + 1] = strdup(mapval);
|
p->axismap[2*i + 1] = strdup(mapval);
|
||||||
|
report(RPT_DEBUG, "%s: map Axis%dpos to %s",
|
||||||
|
drvthis->name, i+1, p->axismap[2*i + 1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < p->buttons; i++) {
|
for (i = 0; i < p->buttons; i++) {
|
||||||
@@ -152,8 +158,11 @@ joy_init (Driver *drvthis)
|
|||||||
|
|
||||||
snprintf(mapkey, sizeof(mapkey), "Map_Button%d", i+1);
|
snprintf(mapkey, sizeof(mapkey), "Map_Button%d", i+1);
|
||||||
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
||||||
if (mapval != NULL)
|
if (mapval != NULL) {
|
||||||
p->buttonmap[i] = strdup(mapval);
|
p->buttonmap[i] = strdup(mapval);
|
||||||
|
report(RPT_DEBUG, "%s: map Button%d to %s",
|
||||||
|
drvthis->name, i+1, p->buttonmap[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of config file parsing (2nd part) */
|
/* End of config file parsing (2nd part) */
|
||||||
@@ -163,6 +172,7 @@ joy_init (Driver *drvthis)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
joy_close (Driver *drvthis)
|
joy_close (Driver *drvthis)
|
||||||
{
|
{
|
||||||
@@ -182,6 +192,7 @@ joy_close (Driver *drvthis)
|
|||||||
drvthis->store_private_ptr(drvthis, NULL);
|
drvthis->store_private_ptr(drvthis, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Tries to read a character from an input device...
|
// Tries to read a character from an input device...
|
||||||
//
|
//
|
||||||
@@ -202,9 +213,6 @@ joy_get_key (Driver *drvthis)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (js.type & JS_EVENT_INIT)
|
|
||||||
// return NULL;
|
|
||||||
|
|
||||||
switch (js.type & ~JS_EVENT_INIT) {
|
switch (js.type & ~JS_EVENT_INIT) {
|
||||||
case JS_EVENT_BUTTON:
|
case JS_EVENT_BUTTON:
|
||||||
/* ignore button release */
|
/* ignore button release */
|
||||||
|
|||||||
Reference in New Issue
Block a user