diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-04 22:42:39 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-04 22:42:39 -0500 |
commit | 752c58a471c108d64da1676b2925dfbd83eb177e (patch) | |
tree | fbffa0d7c54cd812950dffc16d642c9d449f4faf /drivers/usb/input | |
parent | e52b29c2a637f6854d71a45646d7283d984a6dad (diff) | |
parent | 10b1fbdb0a0ca91847a534ad26d0bc250c25b74f (diff) |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/usb/input')
-rw-r--r-- | drivers/usb/input/Kconfig | 10 | ||||
-rw-r--r-- | drivers/usb/input/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 68 | ||||
-rw-r--r-- | drivers/usb/input/trancevibrator.c | 159 | ||||
-rw-r--r-- | drivers/usb/input/usbtouchscreen.c | 6 | ||||
-rw-r--r-- | drivers/usb/input/wacom.h | 2 | ||||
-rw-r--r-- | drivers/usb/input/wacom_sys.c | 20 | ||||
-rw-r--r-- | drivers/usb/input/wacom_wac.c | 121 | ||||
-rw-r--r-- | drivers/usb/input/wacom_wac.h | 2 | ||||
-rw-r--r-- | drivers/usb/input/xpad.c | 178 |
10 files changed, 275 insertions, 294 deletions
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 21cd22640080..20db36448ab3 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -348,13 +348,3 @@ config USB_APPLETOUCH | |||
348 | 348 | ||
349 | To compile this driver as a module, choose M here: the | 349 | To compile this driver as a module, choose M here: the |
350 | module will be called appletouch. | 350 | module will be called appletouch. |
351 | |||
352 | config USB_TRANCEVIBRATOR | ||
353 | tristate "PlayStation 2 Trance Vibrator driver support" | ||
354 | depends on USB | ||
355 | help | ||
356 | Say Y here if you want to connect a PlayStation 2 Trance Vibrator | ||
357 | device to your computer's USB port. | ||
358 | |||
359 | To compile this driver as a module, choose M here: the | ||
360 | module will be called trancevibrator. | ||
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 295f459d1079..d946d5213b30 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Multipart objects. | 5 | # Multipart objects. |
6 | wacom-objs := wacom_sys.o wacom_wac.o | 6 | wacom-objs := wacom_wac.o wacom_sys.o |
7 | usbhid-objs := hid-core.o | 7 | usbhid-objs := hid-core.o |
8 | 8 | ||
9 | # Optional parts of multipart objects. | 9 | # Optional parts of multipart objects. |
@@ -48,7 +48,6 @@ obj-$(CONFIG_USB_ACECAD) += acecad.o | |||
48 | obj-$(CONFIG_USB_YEALINK) += yealink.o | 48 | obj-$(CONFIG_USB_YEALINK) += yealink.o |
49 | obj-$(CONFIG_USB_XPAD) += xpad.o | 49 | obj-$(CONFIG_USB_XPAD) += xpad.o |
50 | obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o | 50 | obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o |
51 | obj-$(CONFIG_USB_TRANCEVIBRATOR) += trancevibrator.o | ||
52 | 51 | ||
53 | ifeq ($(CONFIG_USB_DEBUG),y) | 52 | ifeq ($(CONFIG_USB_DEBUG),y) |
54 | EXTRA_CFLAGS += -DDEBUG | 53 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index a6738a83ff5b..6daf85c6eeee 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -270,7 +270,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign | |||
270 | * Read data value from item. | 270 | * Read data value from item. |
271 | */ | 271 | */ |
272 | 272 | ||
273 | static __inline__ __u32 item_udata(struct hid_item *item) | 273 | static u32 item_udata(struct hid_item *item) |
274 | { | 274 | { |
275 | switch (item->size) { | 275 | switch (item->size) { |
276 | case 1: return item->data.u8; | 276 | case 1: return item->data.u8; |
@@ -280,7 +280,7 @@ static __inline__ __u32 item_udata(struct hid_item *item) | |||
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | static __inline__ __s32 item_sdata(struct hid_item *item) | 283 | static s32 item_sdata(struct hid_item *item) |
284 | { | 284 | { |
285 | switch (item->size) { | 285 | switch (item->size) { |
286 | case 1: return item->data.s8; | 286 | case 1: return item->data.s8; |
@@ -727,7 +727,7 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
727 | * done by hand. | 727 | * done by hand. |
728 | */ | 728 | */ |
729 | 729 | ||
730 | static __inline__ __s32 snto32(__u32 value, unsigned n) | 730 | static s32 snto32(__u32 value, unsigned n) |
731 | { | 731 | { |
732 | switch (n) { | 732 | switch (n) { |
733 | case 8: return ((__s8)value); | 733 | case 8: return ((__s8)value); |
@@ -741,30 +741,65 @@ static __inline__ __s32 snto32(__u32 value, unsigned n) | |||
741 | * Convert a signed 32-bit integer to a signed n-bit integer. | 741 | * Convert a signed 32-bit integer to a signed n-bit integer. |
742 | */ | 742 | */ |
743 | 743 | ||
744 | static __inline__ __u32 s32ton(__s32 value, unsigned n) | 744 | static u32 s32ton(__s32 value, unsigned n) |
745 | { | 745 | { |
746 | __s32 a = value >> (n - 1); | 746 | s32 a = value >> (n - 1); |
747 | if (a && a != -1) | 747 | if (a && a != -1) |
748 | return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; | 748 | return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; |
749 | return value & ((1 << n) - 1); | 749 | return value & ((1 << n) - 1); |
750 | } | 750 | } |
751 | 751 | ||
752 | /* | 752 | /* |
753 | * Extract/implement a data field from/to a report. | 753 | * Extract/implement a data field from/to a little endian report (bit array). |
754 | * | ||
755 | * Code sort-of follows HID spec: | ||
756 | * http://www.usb.org/developers/devclass_docs/HID1_11.pdf | ||
757 | * | ||
758 | * While the USB HID spec allows unlimited length bit fields in "report | ||
759 | * descriptors", most devices never use more than 16 bits. | ||
760 | * One model of UPS is claimed to report "LINEV" as a 32-bit field. | ||
761 | * Search linux-kernel and linux-usb-devel archives for "hid-core extract". | ||
754 | */ | 762 | */ |
755 | 763 | ||
756 | static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) | 764 | static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) |
757 | { | 765 | { |
758 | report += (offset >> 5) << 2; offset &= 31; | 766 | u64 x; |
759 | return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1ULL << n) - 1); | 767 | |
768 | WARN_ON(n > 32); | ||
769 | |||
770 | report += offset >> 3; /* adjust byte index */ | ||
771 | offset &= 7; /* now only need bit offset into one byte */ | ||
772 | x = get_unaligned((u64 *) report); | ||
773 | x = le64_to_cpu(x); | ||
774 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ | ||
775 | return (u32) x; | ||
760 | } | 776 | } |
761 | 777 | ||
778 | /* | ||
779 | * "implement" : set bits in a little endian bit stream. | ||
780 | * Same concepts as "extract" (see comments above). | ||
781 | * The data mangled in the bit stream remains in little endian | ||
782 | * order the whole time. It make more sense to talk about | ||
783 | * endianness of register values by considering a register | ||
784 | * a "cached" copy of the little endiad bit stream. | ||
785 | */ | ||
762 | static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) | 786 | static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) |
763 | { | 787 | { |
764 | report += (offset >> 5) << 2; offset &= 31; | 788 | u64 x; |
765 | put_unaligned((get_unaligned((__le64*)report) | 789 | u64 m = (1ULL << n) - 1; |
766 | & cpu_to_le64(~((((__u64) 1 << n) - 1) << offset))) | 790 | |
767 | | cpu_to_le64((__u64)value << offset), (__le64*)report); | 791 | WARN_ON(n > 32); |
792 | |||
793 | WARN_ON(value > m); | ||
794 | value &= m; | ||
795 | |||
796 | report += offset >> 3; | ||
797 | offset &= 7; | ||
798 | |||
799 | x = get_unaligned((u64 *)report); | ||
800 | x &= cpu_to_le64(~(m << offset)); | ||
801 | x |= cpu_to_le64(((u64) value) << offset); | ||
802 | put_unaligned(x, (u64 *) report); | ||
768 | } | 803 | } |
769 | 804 | ||
770 | /* | 805 | /* |
@@ -1381,6 +1416,9 @@ void hid_close(struct hid_device *hid) | |||
1381 | 1416 | ||
1382 | #define USB_VENDOR_ID_PANJIT 0x134c | 1417 | #define USB_VENDOR_ID_PANJIT 0x134c |
1383 | 1418 | ||
1419 | #define USB_VENDOR_ID_TURBOX 0x062a | ||
1420 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | ||
1421 | |||
1384 | /* | 1422 | /* |
1385 | * Initialize all reports | 1423 | * Initialize all reports |
1386 | */ | 1424 | */ |
@@ -1602,6 +1640,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1602 | #define USB_VENDOR_ID_SUN 0x0430 | 1640 | #define USB_VENDOR_ID_SUN 0x0430 |
1603 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 1641 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
1604 | 1642 | ||
1643 | #define USB_VENDOR_ID_AIRCABLE 0x16CA | ||
1644 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 | ||
1645 | |||
1605 | /* | 1646 | /* |
1606 | * Alphabetically sorted blacklist by quirk type. | 1647 | * Alphabetically sorted blacklist by quirk type. |
1607 | */ | 1648 | */ |
@@ -1619,6 +1660,7 @@ static const struct hid_blacklist { | |||
1619 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, | 1660 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, |
1620 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, | 1661 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, |
1621 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, | 1662 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, |
1663 | { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, | ||
1622 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, | 1664 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, |
1623 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, | 1665 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, |
1624 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, | 1666 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, |
@@ -1768,6 +1810,8 @@ static const struct hid_blacklist { | |||
1768 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | 1810 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, |
1769 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | 1811 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, |
1770 | 1812 | ||
1813 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | ||
1814 | |||
1771 | { 0, 0 } | 1815 | { 0, 0 } |
1772 | }; | 1816 | }; |
1773 | 1817 | ||
diff --git a/drivers/usb/input/trancevibrator.c b/drivers/usb/input/trancevibrator.c deleted file mode 100644 index 33cd91d11eca..000000000000 --- a/drivers/usb/input/trancevibrator.c +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* | ||
2 | * PlayStation 2 Trance Vibrator driver | ||
3 | * | ||
4 | * Copyright (C) 2006 Sam Hocevar <sam@zoy.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | /* Standard include files */ | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/usb.h> | ||
27 | |||
28 | /* Version Information */ | ||
29 | #define DRIVER_VERSION "v1.1" | ||
30 | #define DRIVER_AUTHOR "Sam Hocevar, sam@zoy.org" | ||
31 | #define DRIVER_DESC "PlayStation 2 Trance Vibrator driver" | ||
32 | |||
33 | #define TRANCEVIBRATOR_VENDOR_ID 0x0b49 /* ASCII Corporation */ | ||
34 | #define TRANCEVIBRATOR_PRODUCT_ID 0x064f /* Trance Vibrator */ | ||
35 | |||
36 | static struct usb_device_id id_table [] = { | ||
37 | { USB_DEVICE(TRANCEVIBRATOR_VENDOR_ID, TRANCEVIBRATOR_PRODUCT_ID) }, | ||
38 | { }, | ||
39 | }; | ||
40 | MODULE_DEVICE_TABLE (usb, id_table); | ||
41 | |||
42 | /* Driver-local specific stuff */ | ||
43 | struct trancevibrator { | ||
44 | struct usb_device *udev; | ||
45 | unsigned int speed; | ||
46 | }; | ||
47 | |||
48 | static ssize_t show_speed(struct device *dev, struct device_attribute *attr, | ||
49 | char *buf) | ||
50 | { | ||
51 | struct usb_interface *intf = to_usb_interface(dev); | ||
52 | struct trancevibrator *tv = usb_get_intfdata(intf); | ||
53 | |||
54 | return sprintf(buf, "%d\n", tv->speed); | ||
55 | } | ||
56 | |||
57 | static ssize_t set_speed(struct device *dev, struct device_attribute *attr, | ||
58 | const char *buf, size_t count) | ||
59 | { | ||
60 | struct usb_interface *intf = to_usb_interface(dev); | ||
61 | struct trancevibrator *tv = usb_get_intfdata(intf); | ||
62 | int temp, retval; | ||
63 | |||
64 | temp = simple_strtoul(buf, NULL, 10); | ||
65 | if (temp > 255) | ||
66 | temp = 255; | ||
67 | else if (temp < 0) | ||
68 | temp = 0; | ||
69 | tv->speed = temp; | ||
70 | |||
71 | dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed); | ||
72 | |||
73 | /* Set speed */ | ||
74 | retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0), | ||
75 | 0x01, /* vendor request: set speed */ | ||
76 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
77 | tv->speed, /* speed value */ | ||
78 | 0, NULL, 0, USB_CTRL_GET_TIMEOUT); | ||
79 | if (retval) { | ||
80 | dev_dbg(&tv->udev->dev, "retval = %d\n", retval); | ||
81 | return retval; | ||
82 | } | ||
83 | return count; | ||
84 | } | ||
85 | |||
86 | static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); | ||
87 | |||
88 | static int tv_probe(struct usb_interface *interface, | ||
89 | const struct usb_device_id *id) | ||
90 | { | ||
91 | struct usb_device *udev = interface_to_usbdev(interface); | ||
92 | struct trancevibrator *dev; | ||
93 | int retval; | ||
94 | |||
95 | dev = kzalloc(sizeof(struct trancevibrator), GFP_KERNEL); | ||
96 | if (dev == NULL) { | ||
97 | dev_err(&interface->dev, "Out of memory\n"); | ||
98 | retval = -ENOMEM; | ||
99 | goto error; | ||
100 | } | ||
101 | |||
102 | dev->udev = usb_get_dev(udev); | ||
103 | usb_set_intfdata(interface, dev); | ||
104 | retval = device_create_file(&interface->dev, &dev_attr_speed); | ||
105 | if (retval) | ||
106 | goto error_create_file; | ||
107 | |||
108 | return 0; | ||
109 | |||
110 | error_create_file: | ||
111 | usb_put_dev(udev); | ||
112 | usb_set_intfdata(interface, NULL); | ||
113 | error: | ||
114 | kfree(dev); | ||
115 | return retval; | ||
116 | } | ||
117 | |||
118 | static void tv_disconnect(struct usb_interface *interface) | ||
119 | { | ||
120 | struct trancevibrator *dev; | ||
121 | |||
122 | dev = usb_get_intfdata (interface); | ||
123 | usb_set_intfdata(interface, NULL); | ||
124 | device_remove_file(&interface->dev, &dev_attr_speed); | ||
125 | usb_put_dev(dev->udev); | ||
126 | kfree(dev); | ||
127 | } | ||
128 | |||
129 | /* USB subsystem object */ | ||
130 | static struct usb_driver tv_driver = { | ||
131 | .name = "trancevibrator", | ||
132 | .probe = tv_probe, | ||
133 | .disconnect = tv_disconnect, | ||
134 | .id_table = id_table, | ||
135 | }; | ||
136 | |||
137 | static int __init tv_init(void) | ||
138 | { | ||
139 | int retval = usb_register(&tv_driver); | ||
140 | if (retval) { | ||
141 | err("usb_register failed. Error number %d", retval); | ||
142 | return retval; | ||
143 | } | ||
144 | |||
145 | info(DRIVER_VERSION ":" DRIVER_DESC); | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static void __exit tv_exit(void) | ||
150 | { | ||
151 | usb_deregister(&tv_driver); | ||
152 | } | ||
153 | |||
154 | module_init (tv_init); | ||
155 | module_exit (tv_exit); | ||
156 | |||
157 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
158 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
159 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c index f26c1cd1129f..933ceddf3dee 100644 --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -256,10 +256,10 @@ static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *pr | |||
256 | { | 256 | { |
257 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | 257 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); |
258 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | 258 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); |
259 | *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); | 259 | *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F); |
260 | *touch = ~pkt[7] & 0x20; | 260 | *touch = ~pkt[7] & 0x20; |
261 | 261 | ||
262 | return 1; | 262 | return *touch; |
263 | } | 263 | } |
264 | #endif | 264 | #endif |
265 | 265 | ||
@@ -640,7 +640,7 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
640 | type->max_press, 0, 0); | 640 | type->max_press, 0, 0); |
641 | 641 | ||
642 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, | 642 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, |
643 | usb_rcvintpipe(usbtouch->udev, 0x81), | 643 | usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress), |
644 | usbtouch->data, type->rept_size, | 644 | usbtouch->data, type->rept_size, |
645 | usbtouch_irq, usbtouch, endpoint->bInterval); | 645 | usbtouch_irq, usbtouch, endpoint->bInterval); |
646 | 646 | ||
diff --git a/drivers/usb/input/wacom.h b/drivers/usb/input/wacom.h index 7b3840e378a8..1cf08f02c50e 100644 --- a/drivers/usb/input/wacom.h +++ b/drivers/usb/input/wacom.h | |||
@@ -63,6 +63,7 @@ | |||
63 | * v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c, | 63 | * v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c, |
64 | * - where wacom_sys.c deals with system specific code, | 64 | * - where wacom_sys.c deals with system specific code, |
65 | * - and wacom_wac.c deals with Wacom specific code | 65 | * - and wacom_wac.c deals with Wacom specific code |
66 | * - Support Intuos3 4x6 | ||
66 | */ | 67 | */ |
67 | 68 | ||
68 | /* | 69 | /* |
@@ -118,6 +119,7 @@ extern void wacom_input_sync(void *wcombo); | |||
118 | extern void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 119 | extern void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
119 | extern void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 120 | extern void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
120 | extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 121 | extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
122 | extern void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | ||
121 | extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 123 | extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
122 | extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 124 | extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
123 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 125 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
diff --git a/drivers/usb/input/wacom_sys.c b/drivers/usb/input/wacom_sys.c index d233c37bd533..3498b893b53b 100644 --- a/drivers/usb/input/wacom_sys.c +++ b/drivers/usb/input/wacom_sys.c | |||
@@ -110,7 +110,7 @@ __u16 wacom_be16_to_cpu(unsigned char *data) | |||
110 | __u16 wacom_le16_to_cpu(unsigned char *data) | 110 | __u16 wacom_le16_to_cpu(unsigned char *data) |
111 | { | 111 | { |
112 | __u16 value; | 112 | __u16 value; |
113 | value = be16_to_cpu(*(__be16 *) data); | 113 | value = le16_to_cpu(*(__le16 *) data); |
114 | return value; | 114 | return value; |
115 | } | 115 | } |
116 | 116 | ||
@@ -143,7 +143,7 @@ void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
143 | input_dev->evbit[0] |= BIT(EV_MSC); | 143 | input_dev->evbit[0] |= BIT(EV_MSC); |
144 | input_dev->mscbit[0] |= BIT(MSC_SERIAL); | 144 | input_dev->mscbit[0] |= BIT(MSC_SERIAL); |
145 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); | 145 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); |
146 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); | 146 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_4); |
147 | } | 147 | } |
148 | 148 | ||
149 | void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 149 | void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -155,11 +155,16 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
155 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 155 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); |
156 | } | 156 | } |
157 | 157 | ||
158 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 158 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
159 | { | 159 | { |
160 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); | 160 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); |
161 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); | 161 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3); |
162 | input_set_abs_params(input_dev, ABS_RX, 0, 4097, 0, 0); | 162 | input_set_abs_params(input_dev, ABS_RX, 0, 4097, 0, 0); |
163 | } | ||
164 | |||
165 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | ||
166 | { | ||
167 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); | ||
163 | input_set_abs_params(input_dev, ABS_RY, 0, 4097, 0, 0); | 168 | input_set_abs_params(input_dev, ABS_RY, 0, 4097, 0, 0); |
164 | } | 169 | } |
165 | 170 | ||
@@ -218,8 +223,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
218 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 223 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
219 | 224 | ||
220 | wacom_wac->features = get_wacom_feature(id); | 225 | wacom_wac->features = get_wacom_feature(id); |
221 | if (wacom_wac->features->pktlen > 10) | 226 | BUG_ON(wacom_wac->features->pktlen > 10); |
222 | BUG(); | ||
223 | 227 | ||
224 | input_dev->name = wacom_wac->features->name; | 228 | input_dev->name = wacom_wac->features->name; |
225 | wacom->wacom_wac = wacom_wac; | 229 | wacom->wacom_wac = wacom_wac; |
@@ -244,7 +248,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
244 | usb_fill_int_urb(wacom->irq, dev, | 248 | usb_fill_int_urb(wacom->irq, dev, |
245 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), | 249 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), |
246 | wacom_wac->data, wacom_wac->features->pktlen, | 250 | wacom_wac->data, wacom_wac->features->pktlen, |
247 | wacom_wac->features->irq, wacom, endpoint->bInterval); | 251 | wacom_sys_irq, wacom, endpoint->bInterval); |
248 | wacom->irq->transfer_dma = wacom->data_dma; | 252 | wacom->irq->transfer_dma = wacom->data_dma; |
249 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 253 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
250 | 254 | ||
@@ -278,8 +282,8 @@ static void wacom_disconnect(struct usb_interface *intf) | |||
278 | input_unregister_device(wacom->dev); | 282 | input_unregister_device(wacom->dev); |
279 | usb_free_urb(wacom->irq); | 283 | usb_free_urb(wacom->irq); |
280 | usb_buffer_free(interface_to_usbdev(intf), 10, wacom->wacom_wac->data, wacom->data_dma); | 284 | usb_buffer_free(interface_to_usbdev(intf), 10, wacom->wacom_wac->data, wacom->data_dma); |
281 | kfree(wacom); | ||
282 | kfree(wacom->wacom_wac); | 285 | kfree(wacom->wacom_wac); |
286 | kfree(wacom); | ||
283 | } | 287 | } |
284 | } | 288 | } |
285 | 289 | ||
diff --git a/drivers/usb/input/wacom_wac.c b/drivers/usb/input/wacom_wac.c index aa31d22d4f05..92726fe89379 100644 --- a/drivers/usb/input/wacom_wac.c +++ b/drivers/usb/input/wacom_wac.c | |||
@@ -191,9 +191,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
191 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); | 191 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); |
192 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); | 192 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); |
193 | if (wacom->features->type == WACOM_G4) | 193 | if (wacom->features->type == WACOM_G4) |
194 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6]); | 194 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); |
195 | else | 195 | else |
196 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7]); | 196 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | } | 199 | } |
@@ -303,8 +303,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
303 | wacom->tool[idx] = BTN_TOOL_PEN; | 303 | wacom->tool[idx] = BTN_TOOL_PEN; |
304 | } | 304 | } |
305 | /* only large I3 support Lens Cursor */ | 305 | /* only large I3 support Lens Cursor */ |
306 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) && | 306 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) |
307 | (wacom->features->type == INTUOS3))) { | 307 | && ((wacom->features->type == INTUOS3) |
308 | || (wacom->features->type == INTUOS3S)))) { | ||
308 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */ | 309 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */ |
309 | wacom_report_key(wcombo, wacom->tool[idx], 1); | 310 | wacom_report_key(wcombo, wacom->tool[idx], 1); |
310 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 311 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
@@ -315,10 +316,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
315 | 316 | ||
316 | /* Exit report */ | 317 | /* Exit report */ |
317 | if ((data[1] & 0xfe) == 0x80) { | 318 | if ((data[1] & 0xfe) == 0x80) { |
318 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 319 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) |
319 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | 320 | && ((wacom->features->type == INTUOS3) |
320 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 321 | || (wacom->features->type == INTUOS3S)))) { |
321 | return 2; | 322 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
323 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | ||
324 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | ||
325 | return 2; | ||
326 | } | ||
322 | } | 327 | } |
323 | return 0; | 328 | return 0; |
324 | } | 329 | } |
@@ -382,7 +387,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
382 | wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); | 387 | wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
383 | wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | 388 | wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
384 | 389 | ||
385 | if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2]) | 390 | if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | |
391 | data[2] | (data[3] & 0x1f) | data[4]) | ||
386 | wacom_report_key(wcombo, wacom->tool[1], 1); | 392 | wacom_report_key(wcombo, wacom->tool[1], 1); |
387 | else | 393 | else |
388 | wacom_report_key(wcombo, wacom->tool[1], 0); | 394 | wacom_report_key(wcombo, wacom->tool[1], 0); |
@@ -432,7 +438,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
432 | ((t - 1) / 2) : -t / 2); | 438 | ((t - 1) / 2) : -t / 2); |
433 | } | 439 | } |
434 | 440 | ||
435 | } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3) { | 441 | } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) { |
436 | /* 4D mouse packet */ | 442 | /* 4D mouse packet */ |
437 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 443 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
438 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); | 444 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); |
@@ -452,12 +458,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
452 | - ((data[8] & 0x02) >> 1)); | 458 | - ((data[8] & 0x02) >> 1)); |
453 | 459 | ||
454 | /* I3 2D mouse side buttons */ | 460 | /* I3 2D mouse side buttons */ |
455 | if (wacom->features->type == INTUOS3) { | 461 | if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) { |
456 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); | 462 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); |
457 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); | 463 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); |
458 | } | 464 | } |
459 | 465 | ||
460 | } else if (wacom->features->type < INTUOS3) { | 466 | } else if (wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L) { |
461 | /* Lens cursor packets */ | 467 | /* Lens cursor packets */ |
462 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 468 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
463 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); | 469 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); |
@@ -490,6 +496,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
490 | return (wacom_ptu_irq(wacom_wac, wcombo)); | 496 | return (wacom_ptu_irq(wacom_wac, wcombo)); |
491 | break; | 497 | break; |
492 | case INTUOS: | 498 | case INTUOS: |
499 | case INTUOS3S: | ||
493 | case INTUOS3: | 500 | case INTUOS3: |
494 | case INTUOS3L: | 501 | case INTUOS3L: |
495 | case CINTIQ: | 502 | case CINTIQ: |
@@ -515,6 +522,8 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
515 | case CINTIQ: | 522 | case CINTIQ: |
516 | input_dev_i3(input_dev, wacom_wac); | 523 | input_dev_i3(input_dev, wacom_wac); |
517 | /* fall through */ | 524 | /* fall through */ |
525 | case INTUOS3S: | ||
526 | input_dev_i3s(input_dev, wacom_wac); | ||
518 | case INTUOS: | 527 | case INTUOS: |
519 | input_dev_i(input_dev, wacom_wac); | 528 | input_dev_i(input_dev, wacom_wac); |
520 | break; | 529 | break; |
@@ -530,49 +539,50 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
530 | } | 539 | } |
531 | 540 | ||
532 | static struct wacom_features wacom_features[] = { | 541 | static struct wacom_features wacom_features[] = { |
533 | { "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_sys_irq }, | 542 | { "Wacom Penpartner", 7, 5040, 3780, 255, 0, PENPARTNER }, |
534 | { "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_sys_irq }, | 543 | { "Wacom Graphire", 8, 10206, 7422, 511, 63, GRAPHIRE }, |
535 | { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_sys_irq }, | 544 | { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 63, GRAPHIRE }, |
536 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_sys_irq }, | 545 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 63, GRAPHIRE }, |
537 | { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_sys_irq }, | 546 | { "Wacom Graphire3", 8, 10208, 7424, 511, 63, GRAPHIRE }, |
538 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_sys_irq }, | 547 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63, GRAPHIRE }, |
539 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 32, WACOM_G4, wacom_sys_irq }, | 548 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63, WACOM_G4 }, |
540 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 32, WACOM_G4, wacom_sys_irq }, | 549 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, |
541 | { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_sys_irq }, | 550 | { "Wacom Volito", 8, 5104, 3712, 511, 0, GRAPHIRE }, |
542 | { "Wacom PenStation2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_sys_irq }, | 551 | { "Wacom PenStation2", 8, 3250, 2320, 255, 0, GRAPHIRE }, |
543 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_sys_irq }, | 552 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 0, GRAPHIRE }, |
544 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 32, GRAPHIRE, wacom_sys_irq }, | 553 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 0, GRAPHIRE }, |
545 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_sys_irq }, | 554 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 0, GRAPHIRE }, |
546 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_sys_irq}, | 555 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, |
547 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, | 556 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, |
548 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_sys_irq }, | 557 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, |
549 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_sys_irq }, | 558 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, |
550 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_sys_irq}, | 559 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, |
551 | { "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_sys_irq }, | 560 | { "Wacom PL400", 8, 5408, 4056, 255, 0, PL }, |
552 | { "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_sys_irq }, | 561 | { "Wacom PL500", 8, 6144, 4608, 255, 0, PL }, |
553 | { "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_sys_irq }, | 562 | { "Wacom PL600", 8, 6126, 4604, 255, 0, PL }, |
554 | { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_sys_irq }, | 563 | { "Wacom PL600SX", 8, 6260, 5016, 255, 0, PL }, |
555 | { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_sys_irq }, | 564 | { "Wacom PL550", 8, 6144, 4608, 511, 0, PL }, |
556 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_sys_irq }, | 565 | { "Wacom PL800", 8, 7220, 5780, 511, 0, PL }, |
557 | { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_sys_irq }, | 566 | { "Wacom PL700", 8, 6758, 5406, 511, 0, PL }, |
558 | { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_sys_irq }, | 567 | { "Wacom PL510", 8, 6282, 4762, 511, 0, PL }, |
559 | { "Wacom DTU710", 8, 34080, 27660, 511, 32, PL, wacom_sys_irq }, | 568 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, |
560 | { "Wacom DTF521", 8, 6282, 4762, 511, 32, PL, wacom_sys_irq }, | 569 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, |
561 | { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_sys_irq }, | 570 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, |
562 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PTU, wacom_sys_irq }, | 571 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, |
563 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_sys_irq }, | 572 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, |
564 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, | 573 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, |
565 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_sys_irq }, | 574 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, |
566 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_sys_irq }, | 575 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, |
567 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_sys_irq }, | 576 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, |
568 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_sys_irq }, | 577 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S }, |
569 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_sys_irq }, | 578 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 }, |
570 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_sys_irq }, | 579 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 }, |
571 | { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS3L, wacom_sys_irq }, | 580 | { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 63, INTUOS3L }, |
572 | { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS3L, wacom_sys_irq }, | 581 | { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 63, INTUOS3L }, |
573 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_sys_irq }, | 582 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, |
574 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_sys_irq }, | 583 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 15, INTUOS3S }, |
575 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, | 584 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, |
585 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, | ||
576 | { } | 586 | { } |
577 | }; | 587 | }; |
578 | 588 | ||
@@ -618,6 +628,7 @@ static struct usb_device_id wacom_ids[] = { | |||
618 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, | 628 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, |
619 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, | 629 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, |
620 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | 630 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, |
631 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, | ||
621 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | 632 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, |
622 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 633 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
623 | { } | 634 | { } |
diff --git a/drivers/usb/input/wacom_wac.h b/drivers/usb/input/wacom_wac.h index ceae7bf59d9f..a1d9ce007970 100644 --- a/drivers/usb/input/wacom_wac.h +++ b/drivers/usb/input/wacom_wac.h | |||
@@ -20,6 +20,7 @@ enum { | |||
20 | PTU, | 20 | PTU, |
21 | PL, | 21 | PL, |
22 | INTUOS, | 22 | INTUOS, |
23 | INTUOS3S, | ||
23 | INTUOS3, | 24 | INTUOS3, |
24 | INTUOS3L, | 25 | INTUOS3L, |
25 | CINTIQ, | 26 | CINTIQ, |
@@ -34,7 +35,6 @@ struct wacom_features { | |||
34 | int pressure_max; | 35 | int pressure_max; |
35 | int distance_max; | 36 | int distance_max; |
36 | int type; | 37 | int type; |
37 | usb_complete_t irq; | ||
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct wacom_wac { | 40 | struct wacom_wac { |
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index cebb6c463bfb..df97e5c803f9 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c | |||
@@ -1,8 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * X-Box gamepad - v0.0.5 | 2 | * X-Box gamepad - v0.0.6 |
3 | * | 3 | * |
4 | * Copyright (c) 2002 Marko Friedemann <mfr@bmx-chemnitz.de> | 4 | * Copyright (c) 2002 Marko Friedemann <mfr@bmx-chemnitz.de> |
5 | * | 5 | * 2004 Oliver Schwartz <Oliver.Schwartz@gmx.de>, |
6 | * Steven Toth <steve@toth.demon.co.uk>, | ||
7 | * Franz Lehner <franz@caos.at>, | ||
8 | * Ivan Hawkes <blackhawk@ivanhawkes.com> | ||
9 | * 2005 Dominic Cerquetti <binary1230@yahoo.com> | ||
10 | * 2006 Adam Buchbinder <adam.buchbinder@gmail.com> | ||
6 | * | 11 | * |
7 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License as | 13 | * modify it under the terms of the GNU General Public License as |
@@ -28,11 +33,13 @@ | |||
28 | * - ITO Takayuki for providing essential xpad information on his website | 33 | * - ITO Takayuki for providing essential xpad information on his website |
29 | * - Vojtech Pavlik - iforce driver / input subsystem | 34 | * - Vojtech Pavlik - iforce driver / input subsystem |
30 | * - Greg Kroah-Hartman - usb-skeleton driver | 35 | * - Greg Kroah-Hartman - usb-skeleton driver |
36 | * - XBOX Linux project - extra USB id's | ||
31 | * | 37 | * |
32 | * TODO: | 38 | * TODO: |
33 | * - fine tune axes | 39 | * - fine tune axes (especially trigger axes) |
34 | * - fix "analog" buttons (reported as digital now) | 40 | * - fix "analog" buttons (reported as digital now) |
35 | * - get rumble working | 41 | * - get rumble working |
42 | * - need USB IDs for other dance pads | ||
36 | * | 43 | * |
37 | * History: | 44 | * History: |
38 | * | 45 | * |
@@ -52,30 +59,79 @@ | |||
52 | * - fixed d-pad to axes mapping | 59 | * - fixed d-pad to axes mapping |
53 | * | 60 | * |
54 | * 2002-07-17 - 0.0.5 : simplified d-pad handling | 61 | * 2002-07-17 - 0.0.5 : simplified d-pad handling |
62 | * | ||
63 | * 2004-10-02 - 0.0.6 : DDR pad support | ||
64 | * - borrowed from the XBOX linux kernel | ||
65 | * - USB id's for commonly used dance pads are present | ||
66 | * - dance pads will map D-PAD to buttons, not axes | ||
67 | * - pass the module paramater 'dpad_to_buttons' to force | ||
68 | * the D-PAD to map to buttons if your pad is not detected | ||
55 | */ | 69 | */ |
56 | 70 | ||
57 | #include <linux/kernel.h> | 71 | #include <linux/kernel.h> |
58 | #include <linux/init.h> | 72 | #include <linux/init.h> |
59 | #include <linux/slab.h> | 73 | #include <linux/slab.h> |
74 | #include <linux/stat.h> | ||
60 | #include <linux/module.h> | 75 | #include <linux/module.h> |
76 | #include <linux/moduleparam.h> | ||
61 | #include <linux/smp_lock.h> | 77 | #include <linux/smp_lock.h> |
62 | #include <linux/usb/input.h> | 78 | #include <linux/usb/input.h> |
63 | 79 | ||
64 | #define DRIVER_VERSION "v0.0.5" | 80 | #define DRIVER_VERSION "v0.0.6" |
65 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" | 81 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" |
66 | #define DRIVER_DESC "X-Box pad driver" | 82 | #define DRIVER_DESC "X-Box pad driver" |
67 | 83 | ||
68 | #define XPAD_PKT_LEN 32 | 84 | #define XPAD_PKT_LEN 32 |
69 | 85 | ||
86 | /* xbox d-pads should map to buttons, as is required for DDR pads | ||
87 | but we map them to axes when possible to simplify things */ | ||
88 | #define MAP_DPAD_TO_BUTTONS 0 | ||
89 | #define MAP_DPAD_TO_AXES 1 | ||
90 | #define MAP_DPAD_UNKNOWN -1 | ||
91 | |||
92 | static int dpad_to_buttons; | ||
93 | module_param(dpad_to_buttons, bool, S_IRUGO); | ||
94 | MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads"); | ||
95 | |||
70 | static const struct xpad_device { | 96 | static const struct xpad_device { |
71 | u16 idVendor; | 97 | u16 idVendor; |
72 | u16 idProduct; | 98 | u16 idProduct; |
73 | char *name; | 99 | char *name; |
100 | u8 dpad_mapping; | ||
74 | } xpad_device[] = { | 101 | } xpad_device[] = { |
75 | { 0x045e, 0x0202, "Microsoft X-Box pad (US)" }, | 102 | { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES }, |
76 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)" }, | 103 | { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES }, |
77 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)" }, | 104 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES }, |
78 | { 0x0000, 0x0000, "X-Box pad" } | 105 | { 0x045e, 0x0287, "Microsoft Xbox Controller S", MAP_DPAD_TO_AXES }, |
106 | { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS }, | ||
107 | { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", MAP_DPAD_TO_AXES }, | ||
108 | { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", MAP_DPAD_TO_AXES }, | ||
109 | { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", MAP_DPAD_TO_AXES }, | ||
110 | { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", MAP_DPAD_TO_AXES }, | ||
111 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES }, | ||
112 | { 0x0738, 0x4516, "Mad Catz Control Pad", MAP_DPAD_TO_AXES }, | ||
113 | { 0x0738, 0x4522, "Mad Catz LumiCON", MAP_DPAD_TO_AXES }, | ||
114 | { 0x0738, 0x4526, "Mad Catz Control Pad Pro", MAP_DPAD_TO_AXES }, | ||
115 | { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES }, | ||
116 | { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS }, | ||
117 | { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES }, | ||
118 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS }, | ||
119 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES }, | ||
120 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES }, | ||
121 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES }, | ||
122 | { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES }, | ||
123 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", MAP_DPAD_TO_AXES}, | ||
124 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES }, | ||
125 | { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES }, | ||
126 | { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES }, | ||
127 | { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES }, | ||
128 | { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES }, | ||
129 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES }, | ||
130 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", MAP_DPAD_TO_AXES }, | ||
131 | { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS }, | ||
132 | { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS }, | ||
133 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES }, | ||
134 | { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN } | ||
79 | }; | 135 | }; |
80 | 136 | ||
81 | static const signed short xpad_btn[] = { | 137 | static const signed short xpad_btn[] = { |
@@ -84,11 +140,23 @@ static const signed short xpad_btn[] = { | |||
84 | -1 /* terminating entry */ | 140 | -1 /* terminating entry */ |
85 | }; | 141 | }; |
86 | 142 | ||
143 | /* only used if MAP_DPAD_TO_BUTTONS */ | ||
144 | static const signed short xpad_btn_pad[] = { | ||
145 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ | ||
146 | BTN_0, BTN_1, /* d-pad up, down (XXX names??) */ | ||
147 | -1 /* terminating entry */ | ||
148 | }; | ||
149 | |||
87 | static const signed short xpad_abs[] = { | 150 | static const signed short xpad_abs[] = { |
88 | ABS_X, ABS_Y, /* left stick */ | 151 | ABS_X, ABS_Y, /* left stick */ |
89 | ABS_RX, ABS_RY, /* right stick */ | 152 | ABS_RX, ABS_RY, /* right stick */ |
90 | ABS_Z, ABS_RZ, /* triggers left/right */ | 153 | ABS_Z, ABS_RZ, /* triggers left/right */ |
91 | ABS_HAT0X, ABS_HAT0Y, /* digital pad */ | 154 | -1 /* terminating entry */ |
155 | }; | ||
156 | |||
157 | /* only used if MAP_DPAD_TO_AXES */ | ||
158 | static const signed short xpad_abs_pad[] = { | ||
159 | ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */ | ||
92 | -1 /* terminating entry */ | 160 | -1 /* terminating entry */ |
93 | }; | 161 | }; |
94 | 162 | ||
@@ -100,14 +168,16 @@ static struct usb_device_id xpad_table [] = { | |||
100 | MODULE_DEVICE_TABLE (usb, xpad_table); | 168 | MODULE_DEVICE_TABLE (usb, xpad_table); |
101 | 169 | ||
102 | struct usb_xpad { | 170 | struct usb_xpad { |
103 | struct input_dev *dev; /* input device interface */ | 171 | struct input_dev *dev; /* input device interface */ |
104 | struct usb_device *udev; /* usb device */ | 172 | struct usb_device *udev; /* usb device */ |
105 | 173 | ||
106 | struct urb *irq_in; /* urb for interrupt in report */ | 174 | struct urb *irq_in; /* urb for interrupt in report */ |
107 | unsigned char *idata; /* input data */ | 175 | unsigned char *idata; /* input data */ |
108 | dma_addr_t idata_dma; | 176 | dma_addr_t idata_dma; |
109 | 177 | ||
110 | char phys[65]; /* physical device path */ | 178 | char phys[65]; /* physical device path */ |
179 | |||
180 | int dpad_mapping; /* map d-pad to buttons or to axes */ | ||
111 | }; | 181 | }; |
112 | 182 | ||
113 | /* | 183 | /* |
@@ -137,14 +207,21 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d | |||
137 | input_report_abs(dev, ABS_RZ, data[11]); | 207 | input_report_abs(dev, ABS_RZ, data[11]); |
138 | 208 | ||
139 | /* digital pad */ | 209 | /* digital pad */ |
140 | input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); | 210 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) { |
141 | input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); | 211 | input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); |
212 | input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
213 | } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ { | ||
214 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); | ||
215 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); | ||
216 | input_report_key(dev, BTN_0, data[2] & 0x01); // up | ||
217 | input_report_key(dev, BTN_1, data[2] & 0x02); // down | ||
218 | } | ||
142 | 219 | ||
143 | /* start/back buttons and stick press left/right */ | 220 | /* start/back buttons and stick press left/right */ |
144 | input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); | 221 | input_report_key(dev, BTN_START, data[2] & 0x10); |
145 | input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); | 222 | input_report_key(dev, BTN_BACK, data[2] & 0x20); |
146 | input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); | 223 | input_report_key(dev, BTN_THUMBL, data[2] & 0x40); |
147 | input_report_key(dev, BTN_THUMBR, data[2] >> 7); | 224 | input_report_key(dev, BTN_THUMBR, data[2] & 0x80); |
148 | 225 | ||
149 | /* "analog" buttons A, B, X, Y */ | 226 | /* "analog" buttons A, B, X, Y */ |
150 | input_report_key(dev, BTN_A, data[4]); | 227 | input_report_key(dev, BTN_A, data[4]); |
@@ -206,6 +283,28 @@ static void xpad_close (struct input_dev *dev) | |||
206 | usb_kill_urb(xpad->irq_in); | 283 | usb_kill_urb(xpad->irq_in); |
207 | } | 284 | } |
208 | 285 | ||
286 | static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) | ||
287 | { | ||
288 | set_bit(abs, input_dev->absbit); | ||
289 | |||
290 | switch (abs) { | ||
291 | case ABS_X: | ||
292 | case ABS_Y: | ||
293 | case ABS_RX: | ||
294 | case ABS_RY: /* the two sticks */ | ||
295 | input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128); | ||
296 | break; | ||
297 | case ABS_Z: | ||
298 | case ABS_RZ: /* the triggers */ | ||
299 | input_set_abs_params(input_dev, abs, 0, 255, 0, 0); | ||
300 | break; | ||
301 | case ABS_HAT0X: | ||
302 | case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */ | ||
303 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0); | ||
304 | break; | ||
305 | } | ||
306 | } | ||
307 | |||
209 | static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) | 308 | static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) |
210 | { | 309 | { |
211 | struct usb_device *udev = interface_to_usbdev (intf); | 310 | struct usb_device *udev = interface_to_usbdev (intf); |
@@ -235,6 +334,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
235 | goto fail2; | 334 | goto fail2; |
236 | 335 | ||
237 | xpad->udev = udev; | 336 | xpad->udev = udev; |
337 | xpad->dpad_mapping = xpad_device[i].dpad_mapping; | ||
338 | if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN) | ||
339 | xpad->dpad_mapping = dpad_to_buttons; | ||
238 | xpad->dev = input_dev; | 340 | xpad->dev = input_dev; |
239 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); | 341 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); |
240 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); | 342 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); |
@@ -249,32 +351,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
249 | 351 | ||
250 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 352 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
251 | 353 | ||
354 | /* set up buttons */ | ||
252 | for (i = 0; xpad_btn[i] >= 0; i++) | 355 | for (i = 0; xpad_btn[i] >= 0; i++) |
253 | set_bit(xpad_btn[i], input_dev->keybit); | 356 | set_bit(xpad_btn[i], input_dev->keybit); |
357 | if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) | ||
358 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | ||
359 | set_bit(xpad_btn_pad[i], input_dev->keybit); | ||
254 | 360 | ||
255 | for (i = 0; xpad_abs[i] >= 0; i++) { | 361 | /* set up axes */ |
256 | 362 | for (i = 0; xpad_abs[i] >= 0; i++) | |
257 | signed short t = xpad_abs[i]; | 363 | xpad_set_up_abs(input_dev, xpad_abs[i]); |
258 | 364 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) | |
259 | set_bit(t, input_dev->absbit); | 365 | for (i = 0; xpad_abs_pad[i] >= 0; i++) |
260 | 366 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); | |
261 | switch (t) { | ||
262 | case ABS_X: | ||
263 | case ABS_Y: | ||
264 | case ABS_RX: | ||
265 | case ABS_RY: /* the two sticks */ | ||
266 | input_set_abs_params(input_dev, t, -32768, 32767, 16, 128); | ||
267 | break; | ||
268 | case ABS_Z: | ||
269 | case ABS_RZ: /* the triggers */ | ||
270 | input_set_abs_params(input_dev, t, 0, 255, 0, 0); | ||
271 | break; | ||
272 | case ABS_HAT0X: | ||
273 | case ABS_HAT0Y: /* the d-pad */ | ||
274 | input_set_abs_params(input_dev, t, -1, 1, 0, 0); | ||
275 | break; | ||
276 | } | ||
277 | } | ||
278 | 367 | ||
279 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; | 368 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; |
280 | usb_fill_int_urb(xpad->irq_in, udev, | 369 | usb_fill_int_urb(xpad->irq_in, udev, |
@@ -305,7 +394,8 @@ static void xpad_disconnect(struct usb_interface *intf) | |||
305 | usb_kill_urb(xpad->irq_in); | 394 | usb_kill_urb(xpad->irq_in); |
306 | input_unregister_device(xpad->dev); | 395 | input_unregister_device(xpad->dev); |
307 | usb_free_urb(xpad->irq_in); | 396 | usb_free_urb(xpad->irq_in); |
308 | usb_buffer_free(interface_to_usbdev(intf), XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); | 397 | usb_buffer_free(interface_to_usbdev(intf), XPAD_PKT_LEN, |
398 | xpad->idata, xpad->idata_dma); | ||
309 | kfree(xpad); | 399 | kfree(xpad); |
310 | } | 400 | } |
311 | } | 401 | } |