diff options
Diffstat (limited to 'drivers/hid/hid-sjoy.c')
-rw-r--r-- | drivers/hid/hid-sjoy.c | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/drivers/hid/hid-sjoy.c b/drivers/hid/hid-sjoy.c index 16f7cafc9695..670da9109f86 100644 --- a/drivers/hid/hid-sjoy.c +++ b/drivers/hid/hid-sjoy.c | |||
@@ -65,8 +65,7 @@ static int sjoyff_init(struct hid_device *hid) | |||
65 | { | 65 | { |
66 | struct sjoyff_device *sjoyff; | 66 | struct sjoyff_device *sjoyff; |
67 | struct hid_report *report; | 67 | struct hid_report *report; |
68 | struct hid_input *hidinput = list_entry(hid->inputs.next, | 68 | struct hid_input *hidinput; |
69 | struct hid_input, list); | ||
70 | struct list_head *report_list = | 69 | struct list_head *report_list = |
71 | &hid->report_enum[HID_OUTPUT_REPORT].report_list; | 70 | &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
72 | struct list_head *report_ptr = report_list; | 71 | struct list_head *report_ptr = report_list; |
@@ -78,43 +77,45 @@ static int sjoyff_init(struct hid_device *hid) | |||
78 | return -ENODEV; | 77 | return -ENODEV; |
79 | } | 78 | } |
80 | 79 | ||
81 | report_ptr = report_ptr->next; | 80 | list_for_each_entry(hidinput, &hid->inputs, list) { |
81 | report_ptr = report_ptr->next; | ||
82 | 82 | ||
83 | if (report_ptr == report_list) { | 83 | if (report_ptr == report_list) { |
84 | hid_err(hid, "required output report is missing\n"); | 84 | hid_err(hid, "required output report is missing\n"); |
85 | return -ENODEV; | 85 | return -ENODEV; |
86 | } | 86 | } |
87 | 87 | ||
88 | report = list_entry(report_ptr, struct hid_report, list); | 88 | report = list_entry(report_ptr, struct hid_report, list); |
89 | if (report->maxfield < 1) { | 89 | if (report->maxfield < 1) { |
90 | hid_err(hid, "no fields in the report\n"); | 90 | hid_err(hid, "no fields in the report\n"); |
91 | return -ENODEV; | 91 | return -ENODEV; |
92 | } | 92 | } |
93 | 93 | ||
94 | if (report->field[0]->report_count < 3) { | 94 | if (report->field[0]->report_count < 3) { |
95 | hid_err(hid, "not enough values in the field\n"); | 95 | hid_err(hid, "not enough values in the field\n"); |
96 | return -ENODEV; | 96 | return -ENODEV; |
97 | } | 97 | } |
98 | 98 | ||
99 | sjoyff = kzalloc(sizeof(struct sjoyff_device), GFP_KERNEL); | 99 | sjoyff = kzalloc(sizeof(struct sjoyff_device), GFP_KERNEL); |
100 | if (!sjoyff) | 100 | if (!sjoyff) |
101 | return -ENOMEM; | 101 | return -ENOMEM; |
102 | 102 | ||
103 | dev = hidinput->input; | 103 | dev = hidinput->input; |
104 | 104 | ||
105 | set_bit(FF_RUMBLE, dev->ffbit); | 105 | set_bit(FF_RUMBLE, dev->ffbit); |
106 | 106 | ||
107 | error = input_ff_create_memless(dev, sjoyff, hid_sjoyff_play); | 107 | error = input_ff_create_memless(dev, sjoyff, hid_sjoyff_play); |
108 | if (error) { | 108 | if (error) { |
109 | kfree(sjoyff); | 109 | kfree(sjoyff); |
110 | return error; | 110 | return error; |
111 | } | 111 | } |
112 | 112 | ||
113 | sjoyff->report = report; | 113 | sjoyff->report = report; |
114 | sjoyff->report->field[0]->value[0] = 0x01; | 114 | sjoyff->report->field[0]->value[0] = 0x01; |
115 | sjoyff->report->field[0]->value[1] = 0x00; | 115 | sjoyff->report->field[0]->value[1] = 0x00; |
116 | sjoyff->report->field[0]->value[2] = 0x00; | 116 | sjoyff->report->field[0]->value[2] = 0x00; |
117 | usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT); | 117 | usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT); |
118 | } | ||
118 | 119 | ||
119 | hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n"); | 120 | hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n"); |
120 | 121 | ||
@@ -131,6 +132,8 @@ static int sjoy_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
131 | { | 132 | { |
132 | int ret; | 133 | int ret; |
133 | 134 | ||
135 | hdev->quirks |= id->driver_data; | ||
136 | |||
134 | ret = hid_parse(hdev); | 137 | ret = hid_parse(hdev); |
135 | if (ret) { | 138 | if (ret) { |
136 | hid_err(hdev, "parse failed\n"); | 139 | hid_err(hdev, "parse failed\n"); |
@@ -151,7 +154,17 @@ err: | |||
151 | } | 154 | } |
152 | 155 | ||
153 | static const struct hid_device_id sjoy_devices[] = { | 156 | static const struct hid_device_id sjoy_devices[] = { |
157 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | ||
158 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO), | ||
159 | .driver_data = HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET | | ||
160 | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
161 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO), | ||
162 | .driver_data = HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET | | ||
163 | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
154 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | 164 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, |
165 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD), | ||
166 | .driver_data = HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET | | ||
167 | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
155 | { } | 168 | { } |
156 | }; | 169 | }; |
157 | MODULE_DEVICE_TABLE(hid, sjoy_devices); | 170 | MODULE_DEVICE_TABLE(hid, sjoy_devices); |