patch-2.4.15 linux/drivers/usb/hid-input.c
Next file: linux/drivers/usb/hid.h
Previous file: linux/drivers/usb/catc.c
Back to the patch index
Back to the overall index
- Lines: 32
- Date:
Sun Nov 11 10:09:37 2001
- Orig file:
v2.4.14/linux/drivers/usb/hid-input.c
- Orig date:
Sun Sep 23 11:41:00 2001
diff -u --recursive --new-file v2.4.14/linux/drivers/usb/hid-input.c linux/drivers/usb/hid-input.c
@@ -131,7 +131,8 @@
if (usage->hid == HID_GD_HATSWITCH) {
usage->code = ABS_HAT0X;
- usage->hat = 1 + (field->logical_maximum == 4);
+ usage->hat_min = field->logical_minimum;
+ usage->hat_max = field->logical_maximum;
}
break;
@@ -285,7 +286,7 @@
input->absflat[usage->code] = (b - a) >> 4;
}
- if (usage->hat) {
+ if (usage->hat_min != usage->hat_max) {
int i;
for (i = usage->code; i < usage->code + 2 && i <= max; i++) {
input->absmax[i] = 1;
@@ -302,9 +303,9 @@
struct input_dev *input = &hid->input;
int *quirks = &hid->quirks;
- if (usage->hat) {
- if (usage->hat == 2) value = value * 2;
- if (value > 8) value = 8;
+ if (usage->hat_min != usage->hat_max) {
+ 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;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)