From: Vojtech P. <vo...@us...> - 2001-11-07 09:01:20
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input In directory usw-pr-cvs1:/tmp/cvs-serv23311 Modified Files: hid-input.c Log Message: Better hat fix. Index: hid-input.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/hid-input.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- hid-input.c 2001/11/07 08:12:49 1.17 +++ hid-input.c 2001/11/07 09:01:18 1.18 @@ -58,7 +58,7 @@ static struct { __s32 x; __s32 y; -} hid_hat_to_axis[] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; +} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; static void hidinput_configure_usage(struct hid_device *device, struct hid_field *field, struct hid_usage *usage) { @@ -337,8 +337,8 @@ int *quirks = &hid->quirks; if (usage->hat_min != usage->hat_max) { - value = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1); - if (value > 8) value = 8; + value = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; + if (value < 0 || value > 8) value = 0; input_event(input, usage->type, usage->code , hid_hat_to_axis[value].x); input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[value].y); return; |