summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hlusiak <saschahlusiak@arcor.de>2007-04-20 21:09:10 -0400
committerSascha Hlusiak <saschahlusiak@arcor.de>2007-04-20 21:09:10 -0400
commit25b5234948b6231577d44c5ad97a85d3a82b514a (patch)
tree2d4f68eace9f255b264076f6c73d56c54ba5d404
parente1871e21955d5403c2751e83b5c00b2fa4886f22 (diff)
Fixed wrong button number reported by bsd_jstk.c.xf86-input-joystick-1.2.1
Fixed typo in reporting button and axes numbers in bsd_jstk.c
-rw-r--r--src/bsd_jstk.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/bsd_jstk.c b/src/bsd_jstk.c
index 61ae781..a0c8ea3 100644
--- a/src/bsd_jstk.c
+++ b/src/bsd_jstk.c
@@ -78,7 +78,7 @@ struct jstk_bsd_hid_data {
int
jstkOpenDevice(JoystickDevPtr joystick)
{
- int cur_axis, cur_button;
+ int cur_axis;
int is_joystick, report_id = 0;
int got_something;
struct hid_data *d;
@@ -124,7 +124,6 @@ jstkOpenDevice(JoystickDevPtr joystick)
is_joystick = 0;
got_something = 0;
cur_axis = 0;
- cur_button = 0;
bsddata->hats = 0;
bsddata->axes = 0;
bsddata->buttons = 0;
@@ -172,8 +171,7 @@ jstkOpenDevice(JoystickDevPtr joystick)
{
if (bsddata->buttons < MAXBUTTONS) {
got_something = 1;
- memcpy(&bsddata->button_item[cur_button], &h, sizeof(h));
- cur_button++;
+ memcpy(&bsddata->button_item[bsddata->buttons], &h, sizeof(h));
bsddata->buttons++;
}
}
@@ -192,7 +190,7 @@ jstkOpenDevice(JoystickDevPtr joystick)
bsddata->hotdata = 0;
joystick->devicedata = (void*) bsddata;
xf86Msg(X_INFO, "Joystick: %d buttons, %d axes\n",
- bsddata->axes, bsddata->buttons);
+ bsddata->buttons, bsddata->axes);
return joystick->fd;
}
@@ -300,8 +298,9 @@ jstkReadData(JoystickDevPtr joystick,
for (j=0; j<bsddata->buttons; j++)
{
- int pressed = (d == bsddata->button_item[j].logical_minimum) ? 0 : 1;
+ int pressed;
d = hid_get_data(bsddata->data_buf, &bsddata->button_item[j]);
+ pressed = (d == bsddata->button_item[j].logical_minimum) ? 0 : 1;
if (pressed != joystick->button[j].pressed) {
joystick->button[j].pressed = pressed;
if (event != NULL) *event = EVENT_BUTTON;