diff options
Diffstat (limited to 'drivers/usb/input')
-rw-r--r-- | drivers/usb/input/Kconfig | 2 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 50 | ||||
-rw-r--r-- | drivers/usb/input/hid-ff.c | 5 | ||||
-rw-r--r-- | drivers/usb/input/hiddev.c | 2 | ||||
-rw-r--r-- | drivers/usb/input/usbhid.h | 3 | ||||
-rw-r--r-- | drivers/usb/input/usbtouchscreen.c | 98 |
6 files changed, 92 insertions, 68 deletions
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 258a5d09d3dc..c7d887540d8d 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -7,7 +7,7 @@ comment "USB Input Devices" | |||
7 | config USB_HID | 7 | config USB_HID |
8 | tristate "USB Human Interface Device (full HID) support" | 8 | tristate "USB Human Interface Device (full HID) support" |
9 | default y | 9 | default y |
10 | depends on USB | 10 | depends on USB && INPUT |
11 | select HID | 11 | select HID |
12 | ---help--- | 12 | ---help--- |
13 | Say Y here if you want full HID support to connect USB keyboards, | 13 | Say Y here if you want full HID support to connect USB keyboards, |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 89fa6885709b..c6c9e72e5fd9 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -56,11 +56,6 @@ static unsigned int hid_mousepoll_interval; | |||
56 | module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); | 56 | module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); |
57 | MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); | 57 | MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); |
58 | 58 | ||
59 | static int usbhid_pb_fnmode = 1; | ||
60 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); | ||
61 | MODULE_PARM_DESC(pb_fnmode, | ||
62 | "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)"); | ||
63 | |||
64 | /* | 59 | /* |
65 | * Input submission and I/O error handler. | 60 | * Input submission and I/O error handler. |
66 | */ | 61 | */ |
@@ -106,18 +101,18 @@ static void hid_reset(struct work_struct *work) | |||
106 | 101 | ||
107 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) { | 102 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) { |
108 | dev_dbg(&usbhid->intf->dev, "clear halt\n"); | 103 | dev_dbg(&usbhid->intf->dev, "clear halt\n"); |
109 | rc = usb_clear_halt(to_usb_device(hid->dev), usbhid->urbin->pipe); | 104 | rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid->urbin->pipe); |
110 | clear_bit(HID_CLEAR_HALT, &usbhid->iofl); | 105 | clear_bit(HID_CLEAR_HALT, &usbhid->iofl); |
111 | hid_start_in(hid); | 106 | hid_start_in(hid); |
112 | } | 107 | } |
113 | 108 | ||
114 | else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) { | 109 | else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) { |
115 | dev_dbg(&usbhid->intf->dev, "resetting device\n"); | 110 | dev_dbg(&usbhid->intf->dev, "resetting device\n"); |
116 | rc = rc_lock = usb_lock_device_for_reset(to_usb_device(hid->dev), usbhid->intf); | 111 | rc = rc_lock = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf); |
117 | if (rc_lock >= 0) { | 112 | if (rc_lock >= 0) { |
118 | rc = usb_reset_composite_device(to_usb_device(hid->dev), usbhid->intf); | 113 | rc = usb_reset_composite_device(hid_to_usb_dev(hid), usbhid->intf); |
119 | if (rc_lock) | 114 | if (rc_lock) |
120 | usb_unlock_device(to_usb_device(hid->dev)); | 115 | usb_unlock_device(hid_to_usb_dev(hid)); |
121 | } | 116 | } |
122 | clear_bit(HID_RESET_PENDING, &usbhid->iofl); | 117 | clear_bit(HID_RESET_PENDING, &usbhid->iofl); |
123 | } | 118 | } |
@@ -129,8 +124,8 @@ static void hid_reset(struct work_struct *work) | |||
129 | break; | 124 | break; |
130 | default: | 125 | default: |
131 | err("can't reset device, %s-%s/input%d, status %d", | 126 | err("can't reset device, %s-%s/input%d, status %d", |
132 | to_usb_device(hid->dev)->bus->bus_name, | 127 | hid_to_usb_dev(hid)->bus->bus_name, |
133 | to_usb_device(hid->dev)->devpath, | 128 | hid_to_usb_dev(hid)->devpath, |
134 | usbhid->ifnum, rc); | 129 | usbhid->ifnum, rc); |
135 | /* FALLTHROUGH */ | 130 | /* FALLTHROUGH */ |
136 | case -EHOSTUNREACH: | 131 | case -EHOSTUNREACH: |
@@ -217,8 +212,8 @@ static void hid_irq_in(struct urb *urb) | |||
217 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 212 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
218 | if (status != -EPERM) { | 213 | if (status != -EPERM) { |
219 | err("can't resubmit intr, %s-%s/input%d, status %d", | 214 | err("can't resubmit intr, %s-%s/input%d, status %d", |
220 | to_usb_device(hid->dev)->bus->bus_name, | 215 | hid_to_usb_dev(hid)->bus->bus_name, |
221 | to_usb_device(hid->dev)->devpath, | 216 | hid_to_usb_dev(hid)->devpath, |
222 | usbhid->ifnum, status); | 217 | usbhid->ifnum, status); |
223 | hid_io_error(hid); | 218 | hid_io_error(hid); |
224 | } | 219 | } |
@@ -251,7 +246,7 @@ static int hid_submit_out(struct hid_device *hid) | |||
251 | 246 | ||
252 | hid_output_report(report, usbhid->outbuf); | 247 | hid_output_report(report, usbhid->outbuf); |
253 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 248 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
254 | usbhid->urbout->dev = to_usb_device(hid->dev); | 249 | usbhid->urbout->dev = hid_to_usb_dev(hid); |
255 | 250 | ||
256 | dbg("submitting out urb"); | 251 | dbg("submitting out urb"); |
257 | 252 | ||
@@ -276,13 +271,13 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
276 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 271 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
277 | if (dir == USB_DIR_OUT) { | 272 | if (dir == USB_DIR_OUT) { |
278 | hid_output_report(report, usbhid->ctrlbuf); | 273 | hid_output_report(report, usbhid->ctrlbuf); |
279 | usbhid->urbctrl->pipe = usb_sndctrlpipe(to_usb_device(hid->dev), 0); | 274 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); |
280 | usbhid->urbctrl->transfer_buffer_length = len; | 275 | usbhid->urbctrl->transfer_buffer_length = len; |
281 | } else { | 276 | } else { |
282 | int maxpacket, padlen; | 277 | int maxpacket, padlen; |
283 | 278 | ||
284 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(to_usb_device(hid->dev), 0); | 279 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); |
285 | maxpacket = usb_maxpacket(to_usb_device(hid->dev), usbhid->urbctrl->pipe, 0); | 280 | maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); |
286 | if (maxpacket > 0) { | 281 | if (maxpacket > 0) { |
287 | padlen = (len + maxpacket - 1) / maxpacket; | 282 | padlen = (len + maxpacket - 1) / maxpacket; |
288 | padlen *= maxpacket; | 283 | padlen *= maxpacket; |
@@ -292,7 +287,7 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
292 | padlen = 0; | 287 | padlen = 0; |
293 | usbhid->urbctrl->transfer_buffer_length = padlen; | 288 | usbhid->urbctrl->transfer_buffer_length = padlen; |
294 | } | 289 | } |
295 | usbhid->urbctrl->dev = to_usb_device(hid->dev); | 290 | usbhid->urbctrl->dev = hid_to_usb_dev(hid); |
296 | 291 | ||
297 | usbhid->cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE | dir; | 292 | usbhid->cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE | dir; |
298 | usbhid->cr->bRequest = (dir == USB_DIR_OUT) ? HID_REQ_SET_REPORT : HID_REQ_GET_REPORT; | 293 | usbhid->cr->bRequest = (dir == USB_DIR_OUT) ? HID_REQ_SET_REPORT : HID_REQ_GET_REPORT; |
@@ -582,6 +577,7 @@ void usbhid_init_reports(struct hid_device *hid) | |||
582 | } | 577 | } |
583 | 578 | ||
584 | #define USB_VENDOR_ID_GTCO 0x078c | 579 | #define USB_VENDOR_ID_GTCO 0x078c |
580 | #define USB_VENDOR_ID_GTCO_IPANEL_2 0x5543 | ||
585 | #define USB_DEVICE_ID_GTCO_90 0x0090 | 581 | #define USB_DEVICE_ID_GTCO_90 0x0090 |
586 | #define USB_DEVICE_ID_GTCO_100 0x0100 | 582 | #define USB_DEVICE_ID_GTCO_100 0x0100 |
587 | #define USB_DEVICE_ID_GTCO_101 0x0101 | 583 | #define USB_DEVICE_ID_GTCO_101 0x0101 |
@@ -627,6 +623,8 @@ void usbhid_init_reports(struct hid_device *hid) | |||
627 | #define USB_DEVICE_ID_GTCO_1004 0x1004 | 623 | #define USB_DEVICE_ID_GTCO_1004 0x1004 |
628 | #define USB_DEVICE_ID_GTCO_1005 0x1005 | 624 | #define USB_DEVICE_ID_GTCO_1005 0x1005 |
629 | #define USB_DEVICE_ID_GTCO_1006 0x1006 | 625 | #define USB_DEVICE_ID_GTCO_1006 0x1006 |
626 | #define USB_DEVICE_ID_GTCO_8 0x0008 | ||
627 | #define USB_DEVICE_ID_GTCO_d 0x000d | ||
630 | 628 | ||
631 | #define USB_VENDOR_ID_WACOM 0x056a | 629 | #define USB_VENDOR_ID_WACOM 0x056a |
632 | 630 | ||
@@ -791,6 +789,9 @@ void usbhid_init_reports(struct hid_device *hid) | |||
791 | #define USB_VENDOR_ID_LOGITECH 0x046d | 789 | #define USB_VENDOR_ID_LOGITECH 0x046d |
792 | #define USB_DEVICE_ID_LOGITECH_USB_RECEIVER 0xc101 | 790 | #define USB_DEVICE_ID_LOGITECH_USB_RECEIVER 0xc101 |
793 | 791 | ||
792 | #define USB_VENDOR_ID_IMATION 0x0718 | ||
793 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | ||
794 | |||
794 | /* | 795 | /* |
795 | * Alphabetically sorted blacklist by quirk type. | 796 | * Alphabetically sorted blacklist by quirk type. |
796 | */ | 797 | */ |
@@ -875,6 +876,9 @@ static const struct hid_blacklist { | |||
875 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, | 876 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, |
876 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, | 877 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, |
877 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, | 878 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, |
879 | { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_8, HID_QUIRK_IGNORE }, | ||
880 | { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_d, HID_QUIRK_IGNORE }, | ||
881 | { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE }, | ||
878 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, | 882 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, |
879 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, | 883 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, |
880 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, | 884 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, |
@@ -951,7 +955,7 @@ static const struct hid_blacklist { | |||
951 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, | 955 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
952 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | 956 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, |
953 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, | 957 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, |
954 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN }, | 958 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
955 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | 959 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, |
956 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | 960 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, |
957 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | 961 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, |
@@ -1187,7 +1191,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1187 | 1191 | ||
1188 | hid->version = le16_to_cpu(hdesc->bcdHID); | 1192 | hid->version = le16_to_cpu(hdesc->bcdHID); |
1189 | hid->country = hdesc->bCountryCode; | 1193 | hid->country = hdesc->bCountryCode; |
1190 | hid->dev = &dev->dev; | 1194 | hid->dev = &intf->dev; |
1191 | usbhid->intf = intf; | 1195 | usbhid->intf = intf; |
1192 | usbhid->ifnum = interface->desc.bInterfaceNumber; | 1196 | usbhid->ifnum = interface->desc.bInterfaceNumber; |
1193 | 1197 | ||
@@ -1237,10 +1241,6 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1237 | hid->hiddev_hid_event = hiddev_hid_event; | 1241 | hid->hiddev_hid_event = hiddev_hid_event; |
1238 | hid->hiddev_report_event = hiddev_report_event; | 1242 | hid->hiddev_report_event = hiddev_report_event; |
1239 | #endif | 1243 | #endif |
1240 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
1241 | hid->pb_fnmode = usbhid_pb_fnmode; | ||
1242 | #endif | ||
1243 | |||
1244 | return hid; | 1244 | return hid; |
1245 | 1245 | ||
1246 | fail: | 1246 | fail: |
@@ -1282,7 +1282,7 @@ static void hid_disconnect(struct usb_interface *intf) | |||
1282 | usb_free_urb(usbhid->urbctrl); | 1282 | usb_free_urb(usbhid->urbctrl); |
1283 | usb_free_urb(usbhid->urbout); | 1283 | usb_free_urb(usbhid->urbout); |
1284 | 1284 | ||
1285 | hid_free_buffers(to_usb_device(hid->dev), hid); | 1285 | hid_free_buffers(hid_to_usb_dev(hid), hid); |
1286 | hid_free_device(hid); | 1286 | hid_free_device(hid); |
1287 | } | 1287 | } |
1288 | 1288 | ||
diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c index f8f660ee3fac..59ed65e7a621 100644 --- a/drivers/usb/input/hid-ff.c +++ b/drivers/usb/input/hid-ff.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
34 | 34 | ||
35 | #include <linux/hid.h> | 35 | #include <linux/hid.h> |
36 | #include "usbhid.h" | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * This table contains pointers to initializers. To add support for new | 39 | * This table contains pointers to initializers. To add support for new |
@@ -70,8 +71,8 @@ static struct hid_ff_initializer inits[] = { | |||
70 | int hid_ff_init(struct hid_device* hid) | 71 | int hid_ff_init(struct hid_device* hid) |
71 | { | 72 | { |
72 | struct hid_ff_initializer *init; | 73 | struct hid_ff_initializer *init; |
73 | int vendor = le16_to_cpu(to_usb_device(hid->dev)->descriptor.idVendor); | 74 | int vendor = le16_to_cpu(hid_to_usb_dev(hid)->descriptor.idVendor); |
74 | int product = le16_to_cpu(to_usb_device(hid->dev)->descriptor.idProduct); | 75 | int product = le16_to_cpu(hid_to_usb_dev(hid)->descriptor.idProduct); |
75 | 76 | ||
76 | for (init = inits; init->idVendor; init++) | 77 | for (init = inits; init->idVendor; init++) |
77 | if (init->idVendor == vendor && init->idProduct == product) | 78 | if (init->idVendor == vendor && init->idProduct == product) |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 114d6c9f64b1..a8b3d66cd498 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -384,7 +384,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
384 | struct hiddev_list *list = file->private_data; | 384 | struct hiddev_list *list = file->private_data; |
385 | struct hiddev *hiddev = list->hiddev; | 385 | struct hiddev *hiddev = list->hiddev; |
386 | struct hid_device *hid = hiddev->hid; | 386 | struct hid_device *hid = hiddev->hid; |
387 | struct usb_device *dev = to_usb_device(hid->dev); | 387 | struct usb_device *dev = hid_to_usb_dev(hid); |
388 | struct hiddev_collection_info cinfo; | 388 | struct hiddev_collection_info cinfo; |
389 | struct hiddev_report_info rinfo; | 389 | struct hiddev_report_info rinfo; |
390 | struct hiddev_field_info finfo; | 390 | struct hiddev_field_info finfo; |
diff --git a/drivers/usb/input/usbhid.h b/drivers/usb/input/usbhid.h index 830107e5251f..0023f96d4294 100644 --- a/drivers/usb/input/usbhid.h +++ b/drivers/usb/input/usbhid.h | |||
@@ -80,5 +80,8 @@ struct usbhid_device { | |||
80 | 80 | ||
81 | }; | 81 | }; |
82 | 82 | ||
83 | #define hid_to_usb_dev(hid_dev) \ | ||
84 | container_of(hid_dev->dev->parent, struct usb_device, dev) | ||
85 | |||
83 | #endif | 86 | #endif |
84 | 87 | ||
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c index 7f3c57da9bc0..86e37a20f8e5 100644 --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -66,7 +66,7 @@ struct usbtouch_device_info { | |||
66 | 66 | ||
67 | void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); | 67 | void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); |
68 | int (*get_pkt_len) (unsigned char *pkt, int len); | 68 | int (*get_pkt_len) (unsigned char *pkt, int len); |
69 | int (*read_data) (unsigned char *pkt, int *x, int *y, int *touch, int *press); | 69 | int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); |
70 | int (*init) (struct usbtouch_usb *usbtouch); | 70 | int (*init) (struct usbtouch_usb *usbtouch); |
71 | }; | 71 | }; |
72 | 72 | ||
@@ -85,6 +85,9 @@ struct usbtouch_usb { | |||
85 | struct usbtouch_device_info *type; | 85 | struct usbtouch_device_info *type; |
86 | char name[128]; | 86 | char name[128]; |
87 | char phys[64]; | 87 | char phys[64]; |
88 | |||
89 | int x, y; | ||
90 | int touch, press; | ||
88 | }; | 91 | }; |
89 | 92 | ||
90 | 93 | ||
@@ -161,14 +164,14 @@ static struct usb_device_id usbtouch_devices[] = { | |||
161 | #define EGALAX_PKT_TYPE_REPT 0x80 | 164 | #define EGALAX_PKT_TYPE_REPT 0x80 |
162 | #define EGALAX_PKT_TYPE_DIAG 0x0A | 165 | #define EGALAX_PKT_TYPE_DIAG 0x0A |
163 | 166 | ||
164 | static int egalax_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 167 | static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
165 | { | 168 | { |
166 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) | 169 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) |
167 | return 0; | 170 | return 0; |
168 | 171 | ||
169 | *x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F); | 172 | dev->x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F); |
170 | *y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F); | 173 | dev->y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F); |
171 | *touch = pkt[0] & 0x01; | 174 | dev->touch = pkt[0] & 0x01; |
172 | 175 | ||
173 | return 1; | 176 | return 1; |
174 | } | 177 | } |
@@ -195,11 +198,11 @@ static int egalax_get_pkt_len(unsigned char *buf, int len) | |||
195 | * PanJit Part | 198 | * PanJit Part |
196 | */ | 199 | */ |
197 | #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT | 200 | #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT |
198 | static int panjit_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 201 | static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
199 | { | 202 | { |
200 | *x = ((pkt[2] & 0x0F) << 8) | pkt[1]; | 203 | dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; |
201 | *y = ((pkt[4] & 0x0F) << 8) | pkt[3]; | 204 | dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; |
202 | *touch = pkt[0] & 0x01; | 205 | dev->touch = pkt[0] & 0x01; |
203 | 206 | ||
204 | return 1; | 207 | return 1; |
205 | } | 208 | } |
@@ -215,11 +218,11 @@ static int panjit_read_data(unsigned char *pkt, int *x, int *y, int *touch, int | |||
215 | #define MTOUCHUSB_RESET 7 | 218 | #define MTOUCHUSB_RESET 7 |
216 | #define MTOUCHUSB_REQ_CTRLLR_ID 10 | 219 | #define MTOUCHUSB_REQ_CTRLLR_ID 10 |
217 | 220 | ||
218 | static int mtouch_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 221 | static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
219 | { | 222 | { |
220 | *x = (pkt[8] << 8) | pkt[7]; | 223 | dev->x = (pkt[8] << 8) | pkt[7]; |
221 | *y = (pkt[10] << 8) | pkt[9]; | 224 | dev->y = (pkt[10] << 8) | pkt[9]; |
222 | *touch = (pkt[2] & 0x40) ? 1 : 0; | 225 | dev->touch = (pkt[2] & 0x40) ? 1 : 0; |
223 | 226 | ||
224 | return 1; | 227 | return 1; |
225 | } | 228 | } |
@@ -260,14 +263,32 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
260 | * ITM Part | 263 | * ITM Part |
261 | */ | 264 | */ |
262 | #ifdef CONFIG_USB_TOUCHSCREEN_ITM | 265 | #ifdef CONFIG_USB_TOUCHSCREEN_ITM |
263 | static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 266 | static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
264 | { | 267 | { |
265 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | 268 | int touch; |
266 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | 269 | /* |
267 | *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F); | 270 | * ITM devices report invalid x/y data if not touched. |
268 | *touch = ~pkt[7] & 0x20; | 271 | * if the screen was touched before but is not touched any more |
272 | * report touch as 0 with the last valid x/y data once. then stop | ||
273 | * reporting data until touched again. | ||
274 | */ | ||
275 | dev->press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F); | ||
276 | |||
277 | touch = ~pkt[7] & 0x20; | ||
278 | if (!touch) { | ||
279 | if (dev->touch) { | ||
280 | dev->touch = 0; | ||
281 | return 1; | ||
282 | } | ||
269 | 283 | ||
270 | return *touch; | 284 | return 0; |
285 | } | ||
286 | |||
287 | dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | ||
288 | dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | ||
289 | dev->touch = touch; | ||
290 | |||
291 | return 1; | ||
271 | } | 292 | } |
272 | #endif | 293 | #endif |
273 | 294 | ||
@@ -276,7 +297,7 @@ static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *pr | |||
276 | * eTurboTouch part | 297 | * eTurboTouch part |
277 | */ | 298 | */ |
278 | #ifdef CONFIG_USB_TOUCHSCREEN_ETURBO | 299 | #ifdef CONFIG_USB_TOUCHSCREEN_ETURBO |
279 | static int eturbo_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 300 | static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
280 | { | 301 | { |
281 | unsigned int shift; | 302 | unsigned int shift; |
282 | 303 | ||
@@ -285,9 +306,9 @@ static int eturbo_read_data(unsigned char *pkt, int *x, int *y, int *touch, int | |||
285 | return 0; | 306 | return 0; |
286 | 307 | ||
287 | shift = (6 - (pkt[0] & 0x03)); | 308 | shift = (6 - (pkt[0] & 0x03)); |
288 | *x = ((pkt[3] << 7) | pkt[4]) >> shift; | 309 | dev->x = ((pkt[3] << 7) | pkt[4]) >> shift; |
289 | *y = ((pkt[1] << 7) | pkt[2]) >> shift; | 310 | dev->y = ((pkt[1] << 7) | pkt[2]) >> shift; |
290 | *touch = (pkt[0] & 0x10) ? 1 : 0; | 311 | dev->touch = (pkt[0] & 0x10) ? 1 : 0; |
291 | 312 | ||
292 | return 1; | 313 | return 1; |
293 | } | 314 | } |
@@ -307,14 +328,14 @@ static int eturbo_get_pkt_len(unsigned char *buf, int len) | |||
307 | * Gunze part | 328 | * Gunze part |
308 | */ | 329 | */ |
309 | #ifdef CONFIG_USB_TOUCHSCREEN_GUNZE | 330 | #ifdef CONFIG_USB_TOUCHSCREEN_GUNZE |
310 | static int gunze_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 331 | static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
311 | { | 332 | { |
312 | if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80)) | 333 | if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80)) |
313 | return 0; | 334 | return 0; |
314 | 335 | ||
315 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[2] & 0x7F); | 336 | dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[2] & 0x7F); |
316 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[3] & 0x7F); | 337 | dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[3] & 0x7F); |
317 | *touch = pkt[0] & 0x20; | 338 | dev->touch = pkt[0] & 0x20; |
318 | 339 | ||
319 | return 1; | 340 | return 1; |
320 | } | 341 | } |
@@ -383,11 +404,11 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) | |||
383 | } | 404 | } |
384 | 405 | ||
385 | 406 | ||
386 | static int dmc_tsc10_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 407 | static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
387 | { | 408 | { |
388 | *x = ((pkt[2] & 0x03) << 8) | pkt[1]; | 409 | dev->x = ((pkt[2] & 0x03) << 8) | pkt[1]; |
389 | *y = ((pkt[4] & 0x03) << 8) | pkt[3]; | 410 | dev->y = ((pkt[4] & 0x03) << 8) | pkt[3]; |
390 | *touch = pkt[0] & 0x01; | 411 | dev->touch = pkt[0] & 0x01; |
391 | 412 | ||
392 | return 1; | 413 | return 1; |
393 | } | 414 | } |
@@ -492,23 +513,22 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
492 | static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, | 513 | static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, |
493 | unsigned char *pkt, int len) | 514 | unsigned char *pkt, int len) |
494 | { | 515 | { |
495 | int x, y, touch, press; | ||
496 | struct usbtouch_device_info *type = usbtouch->type; | 516 | struct usbtouch_device_info *type = usbtouch->type; |
497 | 517 | ||
498 | if (!type->read_data(pkt, &x, &y, &touch, &press)) | 518 | if (!type->read_data(usbtouch, pkt)) |
499 | return; | 519 | return; |
500 | 520 | ||
501 | input_report_key(usbtouch->input, BTN_TOUCH, touch); | 521 | input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); |
502 | 522 | ||
503 | if (swap_xy) { | 523 | if (swap_xy) { |
504 | input_report_abs(usbtouch->input, ABS_X, y); | 524 | input_report_abs(usbtouch->input, ABS_X, usbtouch->y); |
505 | input_report_abs(usbtouch->input, ABS_Y, x); | 525 | input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); |
506 | } else { | 526 | } else { |
507 | input_report_abs(usbtouch->input, ABS_X, x); | 527 | input_report_abs(usbtouch->input, ABS_X, usbtouch->x); |
508 | input_report_abs(usbtouch->input, ABS_Y, y); | 528 | input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); |
509 | } | 529 | } |
510 | if (type->max_press) | 530 | if (type->max_press) |
511 | input_report_abs(usbtouch->input, ABS_PRESSURE, press); | 531 | input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); |
512 | input_sync(usbtouch->input); | 532 | input_sync(usbtouch->input); |
513 | } | 533 | } |
514 | 534 | ||