Skip to content

Commit 0ae4381

Browse files
dtorJiri Kosina
authored andcommitted
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>
1 parent f635bd1 commit 0ae4381

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

‎drivers/hid/Kconfig‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ config HID_A4TECH
6868
---help---
6969
Support for A4 tech X5 and WOP-35 / Trust 450L mice.
7070

71-
config HID_ACRUX_FF
72-
tristate "ACRUX force feedback"
71+
config HID_ACRUX
72+
tristate "ACRUX game controller support"
7373
depends on USB_HID
74+
---help---
75+
Say Y here if you want to enable support for ACRUX game controllers.
76+
77+
config HID_ACRUX_FF
78+
tristate "ACRUX force feedback support"
79+
depends on HID_ACRUX
7480
select INPUT_FF_MEMLESS
7581
---help---
7682
Say Y here if you want to enable force feedback support for ACRUX

‎drivers/hid/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif
2727

2828
obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o
2929
obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
30-
obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o
30+
obj-$(CONFIG_HID_ACRUX) += hid-axff.o
3131
obj-$(CONFIG_HID_APPLE) += hid-apple.o
3232
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
3333
obj-$(CONFIG_HID_CANDO) += hid-cando.o

‎drivers/hid/hid-axff.c‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <linux/hid.h>
3434

3535
#include "hid-ids.h"
36+
37+
#ifdef CONFIG_HID_ACRUX_FF
3638
#include "usbhid/usbhid.h"
3739

3840
struct axff_device {
@@ -109,6 +111,12 @@ static int axff_init(struct hid_device *hid)
109111
kfree(axff);
110112
return error;
111113
}
114+
#else
115+
static inline int axff_init(struct hid_device *hid)
116+
{
117+
return 0;
118+
}
119+
#endif
112120

113121
static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
114122
{
@@ -139,19 +147,36 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
139147
error);
140148
}
141149

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+
142160
return 0;
143161
}
144162

163+
static void ax_remove(struct hid_device *hdev)
164+
{
165+
hid_hw_close(hdev);
166+
hid_hw_stop(hdev);
167+
}
168+
145169
static const struct hid_device_id ax_devices[] = {
146170
{ HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), },
147171
{ }
148172
};
149173
MODULE_DEVICE_TABLE(hid, ax_devices);
150174

151175
static struct hid_driver ax_driver = {
152-
.name = "acrux",
153-
.id_table = ax_devices,
154-
.probe = ax_probe,
176+
.name = "acrux",
177+
.id_table = ax_devices,
178+
.probe = ax_probe,
179+
.remove = ax_remove,
155180
};
156181

157182
static int __init ax_init(void)

‎drivers/hid/hid-core.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,9 +1289,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
12891289
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
12901290
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
12911291
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
1292-
#if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE)
12931292
{ HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) },
1294-
#endif
12951293
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
12961294
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
12971295
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },

0 commit comments

Comments
 (0)