fix previous commit: use pos/neg instead of +/-

This commit is contained in:
marschap
2006-04-09 11:41:00 +00:00
parent c130d15677
commit 74359dd1f3
3 changed files with 26 additions and 18 deletions
+6 -6
View File
@@ -453,14 +453,14 @@ Size=16x2
Device=/dev/js0
# set the axis map
Map_Axis1- = Left
Map_Axis1+ = Right
Map_Axis2- = Up
Map_Axis2+ = Down
Map_Axis1neg=Left
Map_Axis1pos=Right
Map_Axis2neg=Up
Map_Axis2pos=Down
# set the button map
Map_Button1 = Enter
Map_Button2 = Escape
Map_Button1=Enter
Map_Button2=Escape
+4 -4
View File
@@ -25,11 +25,11 @@ This section covers the joystick input driver for LCDd.
<varlistentry>
<term>
<command>Map_Axis<replaceable>NUM</replaceable>-=</command>
<command>Map_Axis<replaceable>NUM</replaceable>neg=</command>
<arg choice="plain"><replaceable>KEY</replaceable></arg>
</term>
<term>
<command>Map_Axis<replaceable>NUM</replaceable>+=</command>
<command>Map_Axis<replaceable>NUM</replaceable>pos=</command>
<arg choice="plain"><replaceable>KEY</replaceable></arg>
</term>
<listitem>
@@ -39,8 +39,8 @@ This section covers the joystick input driver for LCDd.
<para>
<replaceable>NUM</replaceable> is an integer starting with <literal>1</literal>
that represents each axis with the appendices <literal>+</literal> and
<literal>-</literal> determining the direction.
that represents each axis with the affixes <literal>neg</literal> and
<literal>pos</literal> determining the direction.
The exact numbering of the axes depends on the hardware used.
</para>
+16 -8
View File
@@ -135,15 +135,21 @@ joy_init (Driver *drvthis)
char mapkey[50];
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);
if (mapval != NULL)
if (mapval != NULL) {
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);
if (mapval != NULL)
if (mapval != NULL) {
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++) {
@@ -152,8 +158,11 @@ joy_init (Driver *drvthis)
snprintf(mapkey, sizeof(mapkey), "Map_Button%d", i+1);
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
if (mapval != NULL)
if (mapval != NULL) {
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) */
@@ -163,6 +172,7 @@ joy_init (Driver *drvthis)
return 0;
}
MODULE_EXPORT void
joy_close (Driver *drvthis)
{
@@ -182,6 +192,7 @@ joy_close (Driver *drvthis)
drvthis->store_private_ptr(drvthis, NULL);
}
//////////////////////////////////////////////////////////////////////
// Tries to read a character from an input device...
//
@@ -202,9 +213,6 @@ joy_get_key (Driver *drvthis)
return NULL;
}
//if (js.type & JS_EVENT_INIT)
// return NULL;
switch (js.type & ~JS_EVENT_INIT) {
case JS_EVENT_BUTTON:
/* ignore button release */