diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/input/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/input/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 81 | ||||
-rw-r--r-- | drivers/usb/input/hid-ff.c | 3 | ||||
-rw-r--r-- | drivers/usb/input/hid-plff.c | 129 |
5 files changed, 174 insertions, 50 deletions
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index c7d887540d8d..aa6a620c162f 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -69,6 +69,14 @@ config LOGITECH_FF | |||
69 | Note: if you say N here, this device will still be supported, but without | 69 | Note: if you say N here, this device will still be supported, but without |
70 | force feedback. | 70 | force feedback. |
71 | 71 | ||
72 | config PANTHERLORD_FF | ||
73 | bool "PantherLord USB/PS2 2in1 Adapter support" | ||
74 | depends on HID_FF | ||
75 | select INPUT_FF_MEMLESS if USB_HID | ||
76 | help | ||
77 | Say Y here if you have a PantherLord USB/PS2 2in1 Adapter and want | ||
78 | to enable force feedback support for it. | ||
79 | |||
72 | config THRUSTMASTER_FF | 80 | config THRUSTMASTER_FF |
73 | bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)" | 81 | bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)" |
74 | depends on HID_FF && EXPERIMENTAL | 82 | depends on HID_FF && EXPERIMENTAL |
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 1a24b5bfa05f..a06024e5cd56 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -17,6 +17,9 @@ endif | |||
17 | ifeq ($(CONFIG_LOGITECH_FF),y) | 17 | ifeq ($(CONFIG_LOGITECH_FF),y) |
18 | usbhid-objs += hid-lgff.o | 18 | usbhid-objs += hid-lgff.o |
19 | endif | 19 | endif |
20 | ifeq ($(CONFIG_PANTHERLORD_FF),y) | ||
21 | usbhid-objs += hid-plff.o | ||
22 | endif | ||
20 | ifeq ($(CONFIG_THRUSTMASTER_FF),y) | 23 | ifeq ($(CONFIG_THRUSTMASTER_FF),y) |
21 | usbhid-objs += hid-tmff.o | 24 | usbhid-objs += hid-tmff.o |
22 | endif | 25 | endif |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index c6c9e72e5fd9..e07a30490726 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/hid.h> | 36 | #include <linux/hid.h> |
37 | #include <linux/hiddev.h> | 37 | #include <linux/hiddev.h> |
38 | #include <linux/hid-debug.h> | ||
38 | #include "usbhid.h" | 39 | #include "usbhid.h" |
39 | 40 | ||
40 | /* | 41 | /* |
@@ -220,23 +221,6 @@ static void hid_irq_in(struct urb *urb) | |||
220 | } | 221 | } |
221 | } | 222 | } |
222 | 223 | ||
223 | /* | ||
224 | * Find a report field with a specified HID usage. | ||
225 | */ | ||
226 | #if 0 | ||
227 | struct hid_field *hid_find_field_by_usage(struct hid_device *hid, __u32 wanted_usage, int type) | ||
228 | { | ||
229 | struct hid_report *report; | ||
230 | int i; | ||
231 | |||
232 | list_for_each_entry(report, &hid->report_enum[type].report_list, list) | ||
233 | for (i = 0; i < report->maxfield; i++) | ||
234 | if (report->field[i]->logical == wanted_usage) | ||
235 | return report->field[i]; | ||
236 | return NULL; | ||
237 | } | ||
238 | #endif /* 0 */ | ||
239 | |||
240 | static int hid_submit_out(struct hid_device *hid) | 224 | static int hid_submit_out(struct hid_device *hid) |
241 | { | 225 | { |
242 | struct hid_report *report; | 226 | struct hid_report *report; |
@@ -501,7 +485,7 @@ static int hid_get_class_descriptor(struct usb_device *dev, int ifnum, | |||
501 | { | 485 | { |
502 | int result, retries = 4; | 486 | int result, retries = 4; |
503 | 487 | ||
504 | memset(buf,0,size); // Make sure we parse really received data | 488 | memset(buf, 0, size); |
505 | 489 | ||
506 | do { | 490 | do { |
507 | result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | 491 | result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), |
@@ -528,18 +512,6 @@ void usbhid_close(struct hid_device *hid) | |||
528 | usb_kill_urb(usbhid->urbin); | 512 | usb_kill_urb(usbhid->urbin); |
529 | } | 513 | } |
530 | 514 | ||
531 | static int hidinput_open(struct input_dev *dev) | ||
532 | { | ||
533 | struct hid_device *hid = dev->private; | ||
534 | return usbhid_open(hid); | ||
535 | } | ||
536 | |||
537 | static void hidinput_close(struct input_dev *dev) | ||
538 | { | ||
539 | struct hid_device *hid = dev->private; | ||
540 | usbhid_close(hid); | ||
541 | } | ||
542 | |||
543 | #define USB_VENDOR_ID_PANJIT 0x134c | 515 | #define USB_VENDOR_ID_PANJIT 0x134c |
544 | 516 | ||
545 | #define USB_VENDOR_ID_TURBOX 0x062a | 517 | #define USB_VENDOR_ID_TURBOX 0x062a |
@@ -770,6 +742,7 @@ void usbhid_init_reports(struct hid_device *hid) | |||
770 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | 742 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c |
771 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | 743 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a |
772 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | 744 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b |
745 | #define USB_DEVICE_ID_APPLE_IR 0x8240 | ||
773 | 746 | ||
774 | #define USB_VENDOR_ID_CHERRY 0x046a | 747 | #define USB_VENDOR_ID_CHERRY 0x046a |
775 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | 748 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 |
@@ -792,6 +765,9 @@ void usbhid_init_reports(struct hid_device *hid) | |||
792 | #define USB_VENDOR_ID_IMATION 0x0718 | 765 | #define USB_VENDOR_ID_IMATION 0x0718 |
793 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | 766 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 |
794 | 767 | ||
768 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 | ||
769 | #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 | ||
770 | |||
795 | /* | 771 | /* |
796 | * Alphabetically sorted blacklist by quirk type. | 772 | * Alphabetically sorted blacklist by quirk type. |
797 | */ | 773 | */ |
@@ -946,19 +922,21 @@ static const struct hid_blacklist { | |||
946 | 922 | ||
947 | { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_CYMOTION }, | 923 | { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_CYMOTION }, |
948 | 924 | ||
949 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, | 925 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
950 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_POWERBOOK_HAS_FN }, | 926 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
951 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, | 927 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
952 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, | 928 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
953 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | 929 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
954 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, | 930 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
955 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, | 931 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
956 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | 932 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
957 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN }, | 933 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
958 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, | 934 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
959 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN }, | 935 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
960 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | 936 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
961 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN }, | 937 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
938 | |||
939 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE }, | ||
962 | 940 | ||
963 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, | 941 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, |
964 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | 942 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, |
@@ -969,6 +947,8 @@ static const struct hid_blacklist { | |||
969 | 947 | ||
970 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, | 948 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, |
971 | 949 | ||
950 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
951 | |||
972 | { 0, 0 } | 952 | { 0, 0 } |
973 | }; | 953 | }; |
974 | 954 | ||
@@ -1064,6 +1044,11 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1064 | if (quirks & HID_QUIRK_IGNORE) | 1044 | if (quirks & HID_QUIRK_IGNORE) |
1065 | return NULL; | 1045 | return NULL; |
1066 | 1046 | ||
1047 | if ((quirks & HID_QUIRK_IGNORE_MOUSE) && | ||
1048 | (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)) | ||
1049 | return NULL; | ||
1050 | |||
1051 | |||
1067 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && | 1052 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && |
1068 | (!interface->desc.bNumEndpoints || | 1053 | (!interface->desc.bNumEndpoints || |
1069 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { | 1054 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { |
@@ -1235,8 +1220,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1235 | usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; | 1220 | usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; |
1236 | usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); | 1221 | usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); |
1237 | hid->hidinput_input_event = usb_hidinput_input_event; | 1222 | hid->hidinput_input_event = usb_hidinput_input_event; |
1238 | hid->hidinput_open = hidinput_open; | 1223 | hid->hid_open = usbhid_open; |
1239 | hid->hidinput_close = hidinput_close; | 1224 | hid->hid_close = usbhid_close; |
1240 | #ifdef CONFIG_USB_HIDDEV | 1225 | #ifdef CONFIG_USB_HIDDEV |
1241 | hid->hiddev_hid_event = hiddev_hid_event; | 1226 | hid->hiddev_hid_event = hiddev_hid_event; |
1242 | hid->hiddev_report_event = hiddev_report_event; | 1227 | hid->hiddev_report_event = hiddev_report_event; |
@@ -1315,11 +1300,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1315 | return -ENODEV; | 1300 | return -ENODEV; |
1316 | } | 1301 | } |
1317 | 1302 | ||
1318 | /* This only gets called when we are a single-input (most of the | 1303 | if ((hid->claimed & HID_CLAIMED_INPUT)) |
1319 | * time). IOW, not a HID_QUIRK_MULTI_INPUT. The hid_ff_init() is | ||
1320 | * only useful in this case, and not for multi-input quirks. */ | ||
1321 | if ((hid->claimed & HID_CLAIMED_INPUT) && | ||
1322 | !(hid->quirks & HID_QUIRK_MULTI_INPUT)) | ||
1323 | hid_ff_init(hid); | 1304 | hid_ff_init(hid); |
1324 | 1305 | ||
1325 | printk(KERN_INFO); | 1306 | printk(KERN_INFO); |
diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c index 59ed65e7a621..5d145058a5cb 100644 --- a/drivers/usb/input/hid-ff.c +++ b/drivers/usb/input/hid-ff.c | |||
@@ -58,6 +58,9 @@ static struct hid_ff_initializer inits[] = { | |||
58 | { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */ | 58 | { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */ |
59 | { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ | 59 | { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ |
60 | #endif | 60 | #endif |
61 | #ifdef CONFIG_PANTHERLORD_FF | ||
62 | { 0x810, 0x0001, hid_plff_init }, | ||
63 | #endif | ||
61 | #ifdef CONFIG_THRUSTMASTER_FF | 64 | #ifdef CONFIG_THRUSTMASTER_FF |
62 | { 0x44f, 0xb304, hid_tmff_init }, | 65 | { 0x44f, 0xb304, hid_tmff_init }, |
63 | #endif | 66 | #endif |
diff --git a/drivers/usb/input/hid-plff.c b/drivers/usb/input/hid-plff.c new file mode 100644 index 000000000000..76d2e6e14db4 --- /dev/null +++ b/drivers/usb/input/hid-plff.c | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Force feedback support for PantherLord USB/PS2 2in1 Adapter devices | ||
3 | * | ||
4 | * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com> | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | |||
24 | /* #define DEBUG */ | ||
25 | |||
26 | #define debug(format, arg...) pr_debug("hid-plff: " format "\n" , ## arg) | ||
27 | |||
28 | #include <linux/input.h> | ||
29 | #include <linux/usb.h> | ||
30 | #include <linux/hid.h> | ||
31 | #include "usbhid.h" | ||
32 | |||
33 | struct plff_device { | ||
34 | struct hid_report *report; | ||
35 | }; | ||
36 | |||
37 | static int hid_plff_play(struct input_dev *dev, void *data, | ||
38 | struct ff_effect *effect) | ||
39 | { | ||
40 | struct hid_device *hid = dev->private; | ||
41 | struct plff_device *plff = data; | ||
42 | int left, right; | ||
43 | |||
44 | left = effect->u.rumble.strong_magnitude; | ||
45 | right = effect->u.rumble.weak_magnitude; | ||
46 | debug("called with 0x%04x 0x%04x", left, right); | ||
47 | |||
48 | left = left * 0x7f / 0xffff; | ||
49 | right = right * 0x7f / 0xffff; | ||
50 | |||
51 | plff->report->field[0]->value[2] = left; | ||
52 | plff->report->field[0]->value[3] = right; | ||
53 | debug("running with 0x%02x 0x%02x", left, right); | ||
54 | usbhid_submit_report(hid, plff->report, USB_DIR_OUT); | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | int hid_plff_init(struct hid_device *hid) | ||
60 | { | ||
61 | struct plff_device *plff; | ||
62 | struct hid_report *report; | ||
63 | struct hid_input *hidinput; | ||
64 | struct list_head *report_list = | ||
65 | &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
66 | struct list_head *report_ptr = report_list; | ||
67 | struct input_dev *dev; | ||
68 | int error; | ||
69 | |||
70 | /* The device contains 2 output reports (one for each | ||
71 | HID_QUIRK_MULTI_INPUT device), both containing 1 field, which | ||
72 | contains 4 ff00.0002 usages and 4 16bit absolute values. | ||
73 | |||
74 | The 2 input reports also contain a field which contains | ||
75 | 8 ff00.0001 usages and 8 boolean values. Their meaning is | ||
76 | currently unknown. */ | ||
77 | |||
78 | if (list_empty(report_list)) { | ||
79 | printk(KERN_ERR "hid-plff: no output reports found\n"); | ||
80 | return -ENODEV; | ||
81 | } | ||
82 | |||
83 | list_for_each_entry(hidinput, &hid->inputs, list) { | ||
84 | |||
85 | report_ptr = report_ptr->next; | ||
86 | |||
87 | if (report_ptr == report_list) { | ||
88 | printk(KERN_ERR "hid-plff: required output report is missing\n"); | ||
89 | return -ENODEV; | ||
90 | } | ||
91 | |||
92 | report = list_entry(report_ptr, struct hid_report, list); | ||
93 | if (report->maxfield < 1) { | ||
94 | printk(KERN_ERR "hid-plff: no fields in the report\n"); | ||
95 | return -ENODEV; | ||
96 | } | ||
97 | |||
98 | if (report->field[0]->report_count < 4) { | ||
99 | printk(KERN_ERR "hid-plff: not enough values in the field\n"); | ||
100 | return -ENODEV; | ||
101 | } | ||
102 | |||
103 | plff = kzalloc(sizeof(struct plff_device), GFP_KERNEL); | ||
104 | if (!plff) | ||
105 | return -ENOMEM; | ||
106 | |||
107 | dev = hidinput->input; | ||
108 | |||
109 | set_bit(FF_RUMBLE, dev->ffbit); | ||
110 | |||
111 | error = input_ff_create_memless(dev, plff, hid_plff_play); | ||
112 | if (error) { | ||
113 | kfree(plff); | ||
114 | return error; | ||
115 | } | ||
116 | |||
117 | plff->report = report; | ||
118 | plff->report->field[0]->value[0] = 0x00; | ||
119 | plff->report->field[0]->value[1] = 0x00; | ||
120 | plff->report->field[0]->value[2] = 0x00; | ||
121 | plff->report->field[0]->value[3] = 0x00; | ||
122 | usbhid_submit_report(hid, plff->report, USB_DIR_OUT); | ||
123 | } | ||
124 | |||
125 | printk(KERN_INFO "hid-plff: Force feedback for PantherLord USB/PS2 " | ||
126 | "2in1 Adapters by Anssi Hannula <anssi.hannula@gmail.com>\n"); | ||
127 | |||
128 | return 0; | ||
129 | } | ||