diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-03-11 08:27:34 (GMT) |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-03-12 20:47:18 (GMT) |
commit | 0ae43810976bc969ee158510c4acbe70ed136e61 (patch) | |
tree | 492e13b91d0532a56f559b1a3842c411c54c3094 /drivers/hid/hid-axff.c | |
parent | f635bd11c8d332d917fb9a4cad3071b2357d5b2a (diff) | |
download | linux-0ae43810976bc969ee158510c4acbe70ed136e61.tar.xz |
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.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c index e5b961d..b455428 100644 --- a/drivers/hid/hid-axff.c +++ b/drivers/hid/hid-axff.c @@ -33,6 +33,8 @@ #include <linux/hid.h> #include "hid-ids.h" + +#ifdef CONFIG_HID_ACRUX_FF #include "usbhid/usbhid.h" struct axff_device { @@ -109,6 +111,12 @@ err_free_mem: kfree(axff); return error; } +#else +static inline int axff_init(struct hid_device *hid) +{ + return 0; +} +#endif static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id) { @@ -139,9 +147,25 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id) error); } + /* + * We need to start polling device right away, otherwise + * it will go into a coma. + */ + error = hid_hw_open(hdev); + if (error) { + dev_err(&hdev->dev, "hw open failed\n"); + return error; + } + return 0; } +static void ax_remove(struct hid_device *hdev) +{ + hid_hw_close(hdev); + hid_hw_stop(hdev); +} + static const struct hid_device_id ax_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), }, { } @@ -149,9 +173,10 @@ static const struct hid_device_id ax_devices[] = { MODULE_DEVICE_TABLE(hid, ax_devices); static struct hid_driver ax_driver = { - .name = "acrux", - .id_table = ax_devices, - .probe = ax_probe, + .name = "acrux", + .id_table = ax_devices, + .probe = ax_probe, + .remove = ax_remove, }; static int __init ax_init(void) |