diff options
Diffstat (limited to 'drivers/usb/input')
-rw-r--r-- | drivers/usb/input/Kconfig | 16 | ||||
-rw-r--r-- | drivers/usb/input/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/input/ati_remote.c | 17 | ||||
-rw-r--r-- | drivers/usb/input/ati_remote2.c | 3 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 158 | ||||
-rw-r--r-- | drivers/usb/input/hid-input.c | 17 | ||||
-rw-r--r-- | drivers/usb/input/hid.h | 2 | ||||
-rw-r--r-- | drivers/usb/input/trancevibrator.c | 159 | ||||
-rw-r--r-- | drivers/usb/input/usbkbd.c | 10 | ||||
-rw-r--r-- | drivers/usb/input/usbmouse.c | 4 | ||||
-rw-r--r-- | drivers/usb/input/usbtouchscreen.c | 102 | ||||
-rw-r--r-- | drivers/usb/input/wacom.h | 3 | ||||
-rw-r--r-- | drivers/usb/input/wacom_sys.c | 22 | ||||
-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 | ||||
-rw-r--r-- | drivers/usb/input/yealink.c | 6 |
17 files changed, 466 insertions, 357 deletions
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 21cd22640080..661af7aa6236 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -221,6 +221,7 @@ config USB_TOUCHSCREEN | |||
221 | - ITM | 221 | - ITM |
222 | - some other eTurboTouch | 222 | - some other eTurboTouch |
223 | - Gunze AHL61 | 223 | - Gunze AHL61 |
224 | - DMC TSC-10/25 | ||
224 | 225 | ||
225 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 226 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
226 | a usage description and the required user-space stuff. | 227 | a usage description and the required user-space stuff. |
@@ -258,6 +259,11 @@ config USB_TOUCHSCREEN_GUNZE | |||
258 | bool "Gunze AHL61 device support" if EMBEDDED | 259 | bool "Gunze AHL61 device support" if EMBEDDED |
259 | depends on USB_TOUCHSCREEN | 260 | depends on USB_TOUCHSCREEN |
260 | 261 | ||
262 | config USB_TOUCHSCREEN_DMC_TSC10 | ||
263 | default y | ||
264 | bool "DMC TSC-10/25 device support" if EMBEDDED | ||
265 | depends on USB_TOUCHSCREEN | ||
266 | |||
261 | config USB_YEALINK | 267 | config USB_YEALINK |
262 | tristate "Yealink usb-p1k voip phone" | 268 | tristate "Yealink usb-p1k voip phone" |
263 | depends on USB && INPUT && EXPERIMENTAL | 269 | depends on USB && INPUT && EXPERIMENTAL |
@@ -348,13 +354,3 @@ config USB_APPLETOUCH | |||
348 | 354 | ||
349 | To compile this driver as a module, choose M here: the | 355 | To compile this driver as a module, choose M here: the |
350 | module will be called appletouch. | 356 | 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/ati_remote.c b/drivers/usb/input/ati_remote.c index f659f3028ad2..ff23318dc301 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -630,19 +630,14 @@ static int ati_remote_alloc_buffers(struct usb_device *udev, | |||
630 | */ | 630 | */ |
631 | static void ati_remote_free_buffers(struct ati_remote *ati_remote) | 631 | static void ati_remote_free_buffers(struct ati_remote *ati_remote) |
632 | { | 632 | { |
633 | if (ati_remote->irq_urb) | 633 | usb_free_urb(ati_remote->irq_urb); |
634 | usb_free_urb(ati_remote->irq_urb); | 634 | usb_free_urb(ati_remote->out_urb); |
635 | 635 | ||
636 | if (ati_remote->out_urb) | 636 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, |
637 | usb_free_urb(ati_remote->out_urb); | 637 | ati_remote->inbuf, ati_remote->inbuf_dma); |
638 | 638 | ||
639 | if (ati_remote->inbuf) | 639 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, |
640 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, | 640 | ati_remote->outbuf, ati_remote->outbuf_dma); |
641 | ati_remote->inbuf, ati_remote->inbuf_dma); | ||
642 | |||
643 | if (ati_remote->outbuf) | ||
644 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, | ||
645 | ati_remote->inbuf, ati_remote->outbuf_dma); | ||
646 | } | 641 | } |
647 | 642 | ||
648 | static void ati_remote_input_init(struct ati_remote *ati_remote) | 643 | static void ati_remote_input_init(struct ati_remote *ati_remote) |
diff --git a/drivers/usb/input/ati_remote2.c b/drivers/usb/input/ati_remote2.c index f982a2b4a7f9..83f1f79db7c7 100644 --- a/drivers/usb/input/ati_remote2.c +++ b/drivers/usb/input/ati_remote2.c | |||
@@ -372,8 +372,7 @@ static void ati_remote2_urb_cleanup(struct ati_remote2 *ar2) | |||
372 | int i; | 372 | int i; |
373 | 373 | ||
374 | for (i = 0; i < 2; i++) { | 374 | for (i = 0; i < 2; i++) { |
375 | if (ar2->urb[i]) | 375 | usb_free_urb(ar2->urb[i]); |
376 | usb_free_urb(ar2->urb[i]); | ||
377 | 376 | ||
378 | if (ar2->buf[i]) | 377 | if (ar2->buf[i]) |
379 | usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]); | 378 | usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]); |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index a6738a83ff5b..a49644b7c58e 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 | /* |
@@ -933,20 +968,29 @@ static void hid_retry_timeout(unsigned long _hid) | |||
933 | hid_io_error(hid); | 968 | hid_io_error(hid); |
934 | } | 969 | } |
935 | 970 | ||
936 | /* Workqueue routine to reset the device */ | 971 | /* Workqueue routine to reset the device or clear a halt */ |
937 | static void hid_reset(void *_hid) | 972 | static void hid_reset(void *_hid) |
938 | { | 973 | { |
939 | struct hid_device *hid = (struct hid_device *) _hid; | 974 | struct hid_device *hid = (struct hid_device *) _hid; |
940 | int rc_lock, rc; | 975 | int rc_lock, rc = 0; |
941 | 976 | ||
942 | dev_dbg(&hid->intf->dev, "resetting device\n"); | 977 | if (test_bit(HID_CLEAR_HALT, &hid->iofl)) { |
943 | rc = rc_lock = usb_lock_device_for_reset(hid->dev, hid->intf); | 978 | dev_dbg(&hid->intf->dev, "clear halt\n"); |
944 | if (rc_lock >= 0) { | 979 | rc = usb_clear_halt(hid->dev, hid->urbin->pipe); |
945 | rc = usb_reset_composite_device(hid->dev, hid->intf); | 980 | clear_bit(HID_CLEAR_HALT, &hid->iofl); |
946 | if (rc_lock) | 981 | hid_start_in(hid); |
947 | usb_unlock_device(hid->dev); | 982 | } |
983 | |||
984 | else if (test_bit(HID_RESET_PENDING, &hid->iofl)) { | ||
985 | dev_dbg(&hid->intf->dev, "resetting device\n"); | ||
986 | rc = rc_lock = usb_lock_device_for_reset(hid->dev, hid->intf); | ||
987 | if (rc_lock >= 0) { | ||
988 | rc = usb_reset_composite_device(hid->dev, hid->intf); | ||
989 | if (rc_lock) | ||
990 | usb_unlock_device(hid->dev); | ||
991 | } | ||
992 | clear_bit(HID_RESET_PENDING, &hid->iofl); | ||
948 | } | 993 | } |
949 | clear_bit(HID_RESET_PENDING, &hid->iofl); | ||
950 | 994 | ||
951 | switch (rc) { | 995 | switch (rc) { |
952 | case 0: | 996 | case 0: |
@@ -988,9 +1032,8 @@ static void hid_io_error(struct hid_device *hid) | |||
988 | 1032 | ||
989 | /* Retries failed, so do a port reset */ | 1033 | /* Retries failed, so do a port reset */ |
990 | if (!test_and_set_bit(HID_RESET_PENDING, &hid->iofl)) { | 1034 | if (!test_and_set_bit(HID_RESET_PENDING, &hid->iofl)) { |
991 | if (schedule_work(&hid->reset_work)) | 1035 | schedule_work(&hid->reset_work); |
992 | goto done; | 1036 | goto done; |
993 | clear_bit(HID_RESET_PENDING, &hid->iofl); | ||
994 | } | 1037 | } |
995 | } | 1038 | } |
996 | 1039 | ||
@@ -1014,6 +1057,11 @@ static void hid_irq_in(struct urb *urb) | |||
1014 | hid->retry_delay = 0; | 1057 | hid->retry_delay = 0; |
1015 | hid_input_report(HID_INPUT_REPORT, urb, 1); | 1058 | hid_input_report(HID_INPUT_REPORT, urb, 1); |
1016 | break; | 1059 | break; |
1060 | case -EPIPE: /* stall */ | ||
1061 | clear_bit(HID_IN_RUNNING, &hid->iofl); | ||
1062 | set_bit(HID_CLEAR_HALT, &hid->iofl); | ||
1063 | schedule_work(&hid->reset_work); | ||
1064 | return; | ||
1017 | case -ECONNRESET: /* unlink */ | 1065 | case -ECONNRESET: /* unlink */ |
1018 | case -ENOENT: | 1066 | case -ENOENT: |
1019 | case -ESHUTDOWN: /* unplug */ | 1067 | case -ESHUTDOWN: /* unplug */ |
@@ -1381,6 +1429,9 @@ void hid_close(struct hid_device *hid) | |||
1381 | 1429 | ||
1382 | #define USB_VENDOR_ID_PANJIT 0x134c | 1430 | #define USB_VENDOR_ID_PANJIT 0x134c |
1383 | 1431 | ||
1432 | #define USB_VENDOR_ID_TURBOX 0x062a | ||
1433 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | ||
1434 | |||
1384 | /* | 1435 | /* |
1385 | * Initialize all reports | 1436 | * Initialize all reports |
1386 | */ | 1437 | */ |
@@ -1589,6 +1640,19 @@ void hid_init_reports(struct hid_device *hid) | |||
1589 | 1640 | ||
1590 | #define USB_VENDOR_ID_APPLE 0x05ac | 1641 | #define USB_VENDOR_ID_APPLE 0x05ac |
1591 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | 1642 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 |
1643 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | ||
1644 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | ||
1645 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | ||
1646 | #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 | ||
1647 | #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 | ||
1648 | #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 | ||
1649 | #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 | ||
1650 | #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 | ||
1651 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a | ||
1652 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b | ||
1653 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | ||
1654 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | ||
1655 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | ||
1592 | 1656 | ||
1593 | #define USB_VENDOR_ID_CHERRY 0x046a | 1657 | #define USB_VENDOR_ID_CHERRY 0x046a |
1594 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | 1658 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 |
@@ -1602,6 +1666,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1602 | #define USB_VENDOR_ID_SUN 0x0430 | 1666 | #define USB_VENDOR_ID_SUN 0x0430 |
1603 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 1667 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
1604 | 1668 | ||
1669 | #define USB_VENDOR_ID_AIRCABLE 0x16CA | ||
1670 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 | ||
1671 | |||
1605 | /* | 1672 | /* |
1606 | * Alphabetically sorted blacklist by quirk type. | 1673 | * Alphabetically sorted blacklist by quirk type. |
1607 | */ | 1674 | */ |
@@ -1619,6 +1686,7 @@ static const struct hid_blacklist { | |||
1619 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, | 1686 | { 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 }, | 1687 | { 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 }, | 1688 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, |
1689 | { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, | ||
1622 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, | 1690 | { 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 }, | 1691 | { 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 }, | 1692 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, |
@@ -1752,22 +1820,27 @@ static const struct hid_blacklist { | |||
1752 | 1820 | ||
1753 | { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_CYMOTION }, | 1821 | { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_CYMOTION }, |
1754 | 1822 | ||
1755 | { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN }, | 1823 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, |
1756 | { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN }, | 1824 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_POWERBOOK_HAS_FN }, |
1757 | { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN }, | 1825 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, |
1758 | { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN }, | 1826 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
1759 | { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN }, | 1827 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, |
1760 | { USB_VENDOR_ID_APPLE, 0x0217, HID_QUIRK_POWERBOOK_HAS_FN }, | 1828 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, |
1761 | { USB_VENDOR_ID_APPLE, 0x0218, HID_QUIRK_POWERBOOK_HAS_FN }, | 1829 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
1762 | { USB_VENDOR_ID_APPLE, 0x0219, HID_QUIRK_POWERBOOK_HAS_FN }, | 1830 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, |
1763 | { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, | 1831 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, |
1764 | { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, | 1832 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN }, |
1833 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | ||
1834 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | ||
1835 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | ||
1765 | 1836 | ||
1766 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, | 1837 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, |
1767 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | 1838 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, |
1768 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | 1839 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, |
1769 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | 1840 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, |
1770 | 1841 | ||
1842 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | ||
1843 | |||
1771 | { 0, 0 } | 1844 | { 0, 0 } |
1772 | }; | 1845 | }; |
1773 | 1846 | ||
@@ -1940,7 +2013,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1940 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) | 2013 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) |
1941 | interval = hid_mousepoll_interval; | 2014 | interval = hid_mousepoll_interval; |
1942 | 2015 | ||
1943 | if (endpoint->bEndpointAddress & USB_DIR_IN) { | 2016 | if (usb_endpoint_dir_in(endpoint)) { |
1944 | if (hid->urbin) | 2017 | if (hid->urbin) |
1945 | continue; | 2018 | continue; |
1946 | if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL))) | 2019 | if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL))) |
@@ -2022,13 +2095,9 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
2022 | return hid; | 2095 | return hid; |
2023 | 2096 | ||
2024 | fail: | 2097 | fail: |
2025 | 2098 | usb_free_urb(hid->urbin); | |
2026 | if (hid->urbin) | 2099 | usb_free_urb(hid->urbout); |
2027 | usb_free_urb(hid->urbin); | 2100 | usb_free_urb(hid->urbctrl); |
2028 | if (hid->urbout) | ||
2029 | usb_free_urb(hid->urbout); | ||
2030 | if (hid->urbctrl) | ||
2031 | usb_free_urb(hid->urbctrl); | ||
2032 | hid_free_buffers(dev, hid); | 2101 | hid_free_buffers(dev, hid); |
2033 | hid_free_device(hid); | 2102 | hid_free_device(hid); |
2034 | 2103 | ||
@@ -2059,8 +2128,7 @@ static void hid_disconnect(struct usb_interface *intf) | |||
2059 | 2128 | ||
2060 | usb_free_urb(hid->urbin); | 2129 | usb_free_urb(hid->urbin); |
2061 | usb_free_urb(hid->urbctrl); | 2130 | usb_free_urb(hid->urbctrl); |
2062 | if (hid->urbout) | 2131 | usb_free_urb(hid->urbout); |
2063 | usb_free_urb(hid->urbout); | ||
2064 | 2132 | ||
2065 | hid_free_buffers(hid->dev, hid); | 2133 | hid_free_buffers(hid->dev, hid); |
2066 | hid_free_device(hid); | 2134 | hid_free_device(hid); |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 9a808a3b4d37..68e7ebb978a9 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
@@ -121,6 +121,12 @@ static struct hidinput_key_translation powerbook_numlock_keys[] = { | |||
121 | { } | 121 | { } |
122 | }; | 122 | }; |
123 | 123 | ||
124 | static struct hidinput_key_translation powerbook_iso_keyboard[] = { | ||
125 | { KEY_GRAVE, KEY_102ND }, | ||
126 | { KEY_102ND, KEY_GRAVE }, | ||
127 | { } | ||
128 | }; | ||
129 | |||
124 | static int usbhid_pb_fnmode = 1; | 130 | static int usbhid_pb_fnmode = 1; |
125 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); | 131 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); |
126 | MODULE_PARM_DESC(pb_fnmode, | 132 | MODULE_PARM_DESC(pb_fnmode, |
@@ -195,6 +201,14 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | |||
195 | } | 201 | } |
196 | } | 202 | } |
197 | 203 | ||
204 | if (hid->quirks & HID_QUIRK_POWERBOOK_ISO_KEYBOARD) { | ||
205 | trans = find_translation(powerbook_iso_keyboard, usage->code); | ||
206 | if (trans) { | ||
207 | input_event(input, usage->type, trans->to, value); | ||
208 | return 1; | ||
209 | } | ||
210 | } | ||
211 | |||
198 | return 0; | 212 | return 0; |
199 | } | 213 | } |
200 | 214 | ||
@@ -210,6 +224,9 @@ static void hidinput_pb_setup(struct input_dev *input) | |||
210 | 224 | ||
211 | for (trans = powerbook_numlock_keys; trans->from; trans++) | 225 | for (trans = powerbook_numlock_keys; trans->from; trans++) |
212 | set_bit(trans->to, input->keybit); | 226 | set_bit(trans->to, input->keybit); |
227 | |||
228 | for (trans = powerbook_iso_keyboard; trans->from; trans++) | ||
229 | set_bit(trans->to, input->keybit); | ||
213 | } | 230 | } |
214 | #else | 231 | #else |
215 | static inline int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | 232 | static inline int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, |
diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 9b50effef758..2a9bf07944c0 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h | |||
@@ -260,6 +260,7 @@ struct hid_item { | |||
260 | #define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000 | 260 | #define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000 |
261 | #define HID_QUIRK_POWERBOOK_FN_ON 0x00002000 | 261 | #define HID_QUIRK_POWERBOOK_FN_ON 0x00002000 |
262 | #define HID_QUIRK_INVERT_HWHEEL 0x00004000 | 262 | #define HID_QUIRK_INVERT_HWHEEL 0x00004000 |
263 | #define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000 | ||
263 | 264 | ||
264 | /* | 265 | /* |
265 | * This is the global environment of the parser. This information is | 266 | * This is the global environment of the parser. This information is |
@@ -384,6 +385,7 @@ struct hid_control_fifo { | |||
384 | #define HID_IN_RUNNING 3 | 385 | #define HID_IN_RUNNING 3 |
385 | #define HID_RESET_PENDING 4 | 386 | #define HID_RESET_PENDING 4 |
386 | #define HID_SUSPENDED 5 | 387 | #define HID_SUSPENDED 5 |
388 | #define HID_CLEAR_HALT 6 | ||
387 | 389 | ||
388 | struct hid_input { | 390 | struct hid_input { |
389 | struct list_head list; | 391 | struct list_head list; |
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/usbkbd.c b/drivers/usb/input/usbkbd.c index c73285cf8558..dac88640eab6 100644 --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c | |||
@@ -208,10 +208,8 @@ static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) | |||
208 | 208 | ||
209 | static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) | 209 | static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) |
210 | { | 210 | { |
211 | if (kbd->irq) | 211 | usb_free_urb(kbd->irq); |
212 | usb_free_urb(kbd->irq); | 212 | usb_free_urb(kbd->led); |
213 | if (kbd->led) | ||
214 | usb_free_urb(kbd->led); | ||
215 | if (kbd->new) | 213 | if (kbd->new) |
216 | usb_buffer_free(dev, 8, kbd->new, kbd->new_dma); | 214 | usb_buffer_free(dev, 8, kbd->new, kbd->new_dma); |
217 | if (kbd->cr) | 215 | if (kbd->cr) |
@@ -236,9 +234,7 @@ static int usb_kbd_probe(struct usb_interface *iface, | |||
236 | return -ENODEV; | 234 | return -ENODEV; |
237 | 235 | ||
238 | endpoint = &interface->endpoint[0].desc; | 236 | endpoint = &interface->endpoint[0].desc; |
239 | if (!(endpoint->bEndpointAddress & USB_DIR_IN)) | 237 | if (!usb_endpoint_is_int_in(endpoint)) |
240 | return -ENODEV; | ||
241 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
242 | return -ENODEV; | 238 | return -ENODEV; |
243 | 239 | ||
244 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); | 240 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); |
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c index cbbbea332ed7..68a55642c082 100644 --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c | |||
@@ -126,9 +126,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i | |||
126 | return -ENODEV; | 126 | return -ENODEV; |
127 | 127 | ||
128 | endpoint = &interface->endpoint[0].desc; | 128 | endpoint = &interface->endpoint[0].desc; |
129 | if (!(endpoint->bEndpointAddress & USB_DIR_IN)) | 129 | if (!usb_endpoint_is_int_in(endpoint)) |
130 | return -ENODEV; | ||
131 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
132 | return -ENODEV; | 130 | return -ENODEV; |
133 | 131 | ||
134 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); | 132 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); |
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c index f26c1cd1129f..49704d4ed0e2 100644 --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * - PanJit TouchSet | 8 | * - PanJit TouchSet |
9 | * - eTurboTouch | 9 | * - eTurboTouch |
10 | * - Gunze AHL61 | 10 | * - Gunze AHL61 |
11 | * - DMC TSC-10/25 | ||
11 | * | 12 | * |
12 | * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch> | 13 | * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch> |
13 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 14 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
@@ -30,6 +31,8 @@ | |||
30 | * - ITM parts are from itmtouch.c | 31 | * - ITM parts are from itmtouch.c |
31 | * - 3M parts are from mtouchusb.c | 32 | * - 3M parts are from mtouchusb.c |
32 | * - PanJit parts are from an unmerged driver by Lanslott Gish | 33 | * - PanJit parts are from an unmerged driver by Lanslott Gish |
34 | * - DMC TSC 10/25 are from Holger Schurig, with ideas from an unmerged | ||
35 | * driver from Marius Vollmer | ||
33 | * | 36 | * |
34 | *****************************************************************************/ | 37 | *****************************************************************************/ |
35 | 38 | ||
@@ -44,7 +47,7 @@ | |||
44 | #include <linux/usb/input.h> | 47 | #include <linux/usb/input.h> |
45 | 48 | ||
46 | 49 | ||
47 | #define DRIVER_VERSION "v0.4" | 50 | #define DRIVER_VERSION "v0.5" |
48 | #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" | 51 | #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" |
49 | #define DRIVER_DESC "USB Touchscreen Driver" | 52 | #define DRIVER_DESC "USB Touchscreen Driver" |
50 | 53 | ||
@@ -103,6 +106,7 @@ enum { | |||
103 | DEVTYPE_ITM, | 106 | DEVTYPE_ITM, |
104 | DEVTYPE_ETURBO, | 107 | DEVTYPE_ETURBO, |
105 | DEVTYPE_GUNZE, | 108 | DEVTYPE_GUNZE, |
109 | DEVTYPE_DMC_TSC10, | ||
106 | }; | 110 | }; |
107 | 111 | ||
108 | static struct usb_device_id usbtouch_devices[] = { | 112 | static struct usb_device_id usbtouch_devices[] = { |
@@ -139,6 +143,10 @@ static struct usb_device_id usbtouch_devices[] = { | |||
139 | {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE}, | 143 | {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE}, |
140 | #endif | 144 | #endif |
141 | 145 | ||
146 | #ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 | ||
147 | {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10}, | ||
148 | #endif | ||
149 | |||
142 | {} | 150 | {} |
143 | }; | 151 | }; |
144 | 152 | ||
@@ -256,10 +264,10 @@ static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *pr | |||
256 | { | 264 | { |
257 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | 265 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); |
258 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | 266 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); |
259 | *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); | 267 | *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F); |
260 | *touch = ~pkt[7] & 0x20; | 268 | *touch = ~pkt[7] & 0x20; |
261 | 269 | ||
262 | return 1; | 270 | return *touch; |
263 | } | 271 | } |
264 | #endif | 272 | #endif |
265 | 273 | ||
@@ -313,6 +321,80 @@ static int gunze_read_data(unsigned char *pkt, int *x, int *y, int *touch, int * | |||
313 | #endif | 321 | #endif |
314 | 322 | ||
315 | /***************************************************************************** | 323 | /***************************************************************************** |
324 | * DMC TSC-10/25 Part | ||
325 | * | ||
326 | * Documentation about the controller and it's protocol can be found at | ||
327 | * http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf | ||
328 | * http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf | ||
329 | */ | ||
330 | #ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 | ||
331 | |||
332 | /* supported data rates. currently using 130 */ | ||
333 | #define TSC10_RATE_POINT 0x50 | ||
334 | #define TSC10_RATE_30 0x40 | ||
335 | #define TSC10_RATE_50 0x41 | ||
336 | #define TSC10_RATE_80 0x42 | ||
337 | #define TSC10_RATE_100 0x43 | ||
338 | #define TSC10_RATE_130 0x44 | ||
339 | #define TSC10_RATE_150 0x45 | ||
340 | |||
341 | /* commands */ | ||
342 | #define TSC10_CMD_RESET 0x55 | ||
343 | #define TSC10_CMD_RATE 0x05 | ||
344 | #define TSC10_CMD_DATA1 0x01 | ||
345 | |||
346 | static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) | ||
347 | { | ||
348 | struct usb_device *dev = usbtouch->udev; | ||
349 | int ret; | ||
350 | unsigned char buf[2]; | ||
351 | |||
352 | /* reset */ | ||
353 | buf[0] = buf[1] = 0xFF; | ||
354 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), | ||
355 | TSC10_CMD_RESET, | ||
356 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
357 | 0, 0, buf, 2, USB_CTRL_SET_TIMEOUT); | ||
358 | if (ret < 0) | ||
359 | return ret; | ||
360 | if (buf[0] != 0x06 || buf[1] != 0x00) | ||
361 | return -ENODEV; | ||
362 | |||
363 | /* set coordinate output rate */ | ||
364 | buf[0] = buf[1] = 0xFF; | ||
365 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), | ||
366 | TSC10_CMD_RATE, | ||
367 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
368 | TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT); | ||
369 | if (ret < 0) | ||
370 | return ret; | ||
371 | if (buf[0] != 0x06 || buf[1] != 0x00) | ||
372 | return -ENODEV; | ||
373 | |||
374 | /* start sending data */ | ||
375 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), | ||
376 | TSC10_CMD_DATA1, | ||
377 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
378 | 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
379 | if (ret < 0) | ||
380 | return ret; | ||
381 | |||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | |||
386 | static int dmc_tsc10_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | ||
387 | { | ||
388 | *x = ((pkt[2] & 0x03) << 8) | pkt[1]; | ||
389 | *y = ((pkt[4] & 0x03) << 8) | pkt[3]; | ||
390 | *touch = pkt[0] & 0x01; | ||
391 | |||
392 | return 1; | ||
393 | } | ||
394 | #endif | ||
395 | |||
396 | |||
397 | /***************************************************************************** | ||
316 | * the different device descriptors | 398 | * the different device descriptors |
317 | */ | 399 | */ |
318 | static struct usbtouch_device_info usbtouch_dev_info[] = { | 400 | static struct usbtouch_device_info usbtouch_dev_info[] = { |
@@ -389,6 +471,18 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
389 | .read_data = gunze_read_data, | 471 | .read_data = gunze_read_data, |
390 | }, | 472 | }, |
391 | #endif | 473 | #endif |
474 | |||
475 | #ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 | ||
476 | [DEVTYPE_DMC_TSC10] = { | ||
477 | .min_xc = 0x0, | ||
478 | .max_xc = 0x03ff, | ||
479 | .min_yc = 0x0, | ||
480 | .max_yc = 0x03ff, | ||
481 | .rept_size = 5, | ||
482 | .init = dmc_tsc10_init, | ||
483 | .read_data = dmc_tsc10_read_data, | ||
484 | }, | ||
485 | #endif | ||
392 | }; | 486 | }; |
393 | 487 | ||
394 | 488 | ||
@@ -640,7 +734,7 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
640 | type->max_press, 0, 0); | 734 | type->max_press, 0, 0); |
641 | 735 | ||
642 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, | 736 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, |
643 | usb_rcvintpipe(usbtouch->udev, 0x81), | 737 | usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress), |
644 | usbtouch->data, type->rept_size, | 738 | usbtouch->data, type->rept_size, |
645 | usbtouch_irq, usbtouch, endpoint->bInterval); | 739 | usbtouch_irq, usbtouch, endpoint->bInterval); |
646 | 740 | ||
diff --git a/drivers/usb/input/wacom.h b/drivers/usb/input/wacom.h index 7b3840e378a8..d85abfc5ab58 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 | /* |
@@ -109,7 +110,6 @@ struct wacom_combo { | |||
109 | }; | 110 | }; |
110 | 111 | ||
111 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); | 112 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); |
112 | extern void wacom_sys_irq(struct urb *urb); | ||
113 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); | 113 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); |
114 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); | 114 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); |
115 | extern void wacom_report_key(void *wcombo, unsigned int key_type, int key_data); | 115 | extern void wacom_report_key(void *wcombo, unsigned int key_type, int key_data); |
@@ -118,6 +118,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); | 118 | 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); | 119 | 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); | 120 | extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
121 | 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); | 122 | 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); | 123 | 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); | 124 | 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..e7cc20ab8155 100644 --- a/drivers/usb/input/wacom_sys.c +++ b/drivers/usb/input/wacom_sys.c | |||
@@ -42,7 +42,7 @@ static struct input_dev * get_input_dev(struct wacom_combo *wcombo) | |||
42 | return wcombo->wacom->dev; | 42 | return wcombo->wacom->dev; |
43 | } | 43 | } |
44 | 44 | ||
45 | void wacom_sys_irq(struct urb *urb) | 45 | static void wacom_sys_irq(struct urb *urb) |
46 | { | 46 | { |
47 | struct wacom *wacom = urb->context; | 47 | struct wacom *wacom = urb->context; |
48 | struct wacom_combo wcombo; | 48 | struct wacom_combo wcombo; |
@@ -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 | } |
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 905bf6398257..2268ca311ade 100644 --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c | |||
@@ -859,10 +859,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
859 | 859 | ||
860 | interface = intf->cur_altsetting; | 860 | interface = intf->cur_altsetting; |
861 | endpoint = &interface->endpoint[0].desc; | 861 | endpoint = &interface->endpoint[0].desc; |
862 | if (!(endpoint->bEndpointAddress & USB_DIR_IN)) | 862 | if (!usb_endpoint_is_int_in(endpoint)) |
863 | return -EIO; | 863 | return -ENODEV; |
864 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
865 | return -EIO; | ||
866 | 864 | ||
867 | yld = kzalloc(sizeof(struct yealink_dev), GFP_KERNEL); | 865 | yld = kzalloc(sizeof(struct yealink_dev), GFP_KERNEL); |
868 | if (!yld) | 866 | if (!yld) |