aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-axff.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2011-03-11 03:27:34 -0500
committerJiri Kosina <jkosina@suse.cz>2011-03-12 15:47:18 -0500
commit0ae43810976bc969ee158510c4acbe70ed136e61 (patch)
tree492e13b91d0532a56f559b1a3842c411c54c3094 /drivers/hid/hid-axff.c
parentf635bd11c8d332d917fb9a4cad3071b2357d5b2a (diff)
HID: ACRUX - activate the device immediately after binding
This device does not tolerate delayed opening and goes into a coma if we try to that. Ubuntu even has a crutch for udev that opened the device upon seeing it for the first time, but it did not work if we happened to boot with the device attached, since by the time userspace got around opening the device it was too late. Let's start the device immediately to deal with this issue. Reported-by: Sergei Kolzun <x0r@dv-life.ru> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-axff.c')
-rw-r--r--drivers/hid/hid-axff.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c
index e5b961d6ff22..b4554288de00 100644
--- a/drivers/hid/hid-axff.c
+++ b/drivers/hid/hid-axff.c
@@ -33,6 +33,8 @@
33#include <linux/hid.h> 33#include <linux/hid.h>
34 34
35#include "hid-ids.h" 35#include "hid-ids.h"
36
37#ifdef CONFIG_HID_ACRUX_FF
36#include "usbhid/usbhid.h" 38#include "usbhid/usbhid.h"
37 39
38struct axff_device { 40struct axff_device {
@@ -109,6 +111,12 @@ err_free_mem:
109 kfree(axff); 111 kfree(axff);
110 return error; 112 return error;
111} 113}
114#else
115static inline int axff_init(struct hid_device *hid)
116{
117 return 0;
118}
119#endif
112 120
113static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id) 121static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
114{ 122{
@@ -139,9 +147,25 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
139 error); 147 error);
140 } 148 }
141 149
150 /*
151 * We need to start polling device right away, otherwise
152 * it will go into a coma.
153 */
154 error = hid_hw_open(hdev);
155 if (error) {
156 dev_err(&hdev->dev, "hw open failed\n");
157 return error;
158 }
159
142 return 0; 160 return 0;
143} 161}
144 162
163static void ax_remove(struct hid_device *hdev)
164{
165 hid_hw_close(hdev);
166 hid_hw_stop(hdev);
167}
168
145static const struct hid_device_id ax_devices[] = { 169static const struct hid_device_id ax_devices[] = {
146 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), }, 170 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), },
147 { } 171 { }
@@ -149,9 +173,10 @@ static const struct hid_device_id ax_devices[] = {
149MODULE_DEVICE_TABLE(hid, ax_devices); 173MODULE_DEVICE_TABLE(hid, ax_devices);
150 174
151static struct hid_driver ax_driver = { 175static struct hid_driver ax_driver = {
152 .name = "acrux", 176 .name = "acrux",
153 .id_table = ax_devices, 177 .id_table = ax_devices,
154 .probe = ax_probe, 178 .probe = ax_probe,
179 .remove = ax_remove,
155}; 180};
156 181
157static int __init ax_init(void) 182static int __init ax_init(void)