diff --git a/LCDd.conf b/LCDd.conf index b22994e..3c304f8 100644 --- a/LCDd.conf +++ b/LCDd.conf @@ -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 diff --git a/docs/lcdproc-user/drivers/joy.docbook b/docs/lcdproc-user/drivers/joy.docbook index 219a9e0..b8bf0e2 100644 --- a/docs/lcdproc-user/drivers/joy.docbook +++ b/docs/lcdproc-user/drivers/joy.docbook @@ -25,11 +25,11 @@ This section covers the joystick input driver for LCDd. - Map_AxisNUM-= + Map_AxisNUMneg= KEY - Map_AxisNUM+= + Map_AxisNUMpos= KEY @@ -39,8 +39,8 @@ This section covers the joystick input driver for LCDd. NUM is an integer starting with 1 - that represents each axis with the appendices + and - - determining the direction. + that represents each axis with the affixes neg and + pos determining the direction. The exact numbering of the axes depends on the hardware used. diff --git a/server/drivers/joy.c b/server/drivers/joy.c index b91a44b..973ef55 100644 --- a/server/drivers/joy.c +++ b/server/drivers/joy.c @@ -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 */