* [PATCH] HID: ACRUX - activate the device immediately after binding
@ 2011-03-11 8:27 Dmitry Torokhov
2011-03-12 20:49 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2011-03-11 8:27 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Linux Input, Sergei Kolzun
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>
---
Jiri,
Sergei reports that his friend was able to test the patch and it fixes
the issue for him so I believe we can now apply the patch.
Thanks.
drivers/hid/Kconfig | 10 ++++++++--
drivers/hid/Makefile | 2 +-
drivers/hid/hid-axff.c | 31 ++++++++++++++++++++++++++++---
drivers/hid/hid-core.c | 2 --
4 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 2560f01..b7d4133 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -68,9 +68,15 @@ config HID_A4TECH
---help---
Support for A4 tech X5 and WOP-35 / Trust 450L mice.
-config HID_ACRUX_FF
- tristate "ACRUX force feedback"
+config HID_ACRUX
+ tristate "ACRUX game controller support"
depends on USB_HID
+ ---help---
+ Say Y here if you want to enable support for ACRUX game controllers.
+
+config HID_ACRUX_FF
+ tristate "ACRUX force feedback support"
+ depends on HID_ACRUX
select INPUT_FF_MEMLESS
---help---
Say Y here if you want to enable force feedback support for ACRUX
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 6efc2a0..13e6248 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -27,7 +27,7 @@ endif
obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o
obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
-obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o
+obj-$(CONFIG_HID_ACRUX) += hid-axff.o
obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_CANDO) += hid-cando.o
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)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d678cf3..758c080 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1256,9 +1256,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
-#if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE)
{ HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) },
-#endif
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
--
Dmitry
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: ACRUX - activate the device immediately after binding
2011-03-11 8:27 [PATCH] HID: ACRUX - activate the device immediately after binding Dmitry Torokhov
@ 2011-03-12 20:49 ` Jiri Kosina
2011-03-16 19:13 ` Stephen Kitt
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2011-03-12 20:49 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Linux Input, Sergei Kolzun
On Fri, 11 Mar 2011, Dmitry Torokhov wrote:
> 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>
> ---
>
> Jiri,
>
> Sergei reports that his friend was able to test the patch and it fixes
> the issue for him so I believe we can now apply the patch.
Applied, thanks guys.
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: ACRUX - activate the device immediately after binding
2011-03-12 20:49 ` Jiri Kosina
@ 2011-03-16 19:13 ` Stephen Kitt
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Kitt @ 2011-03-16 19:13 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Dmitry Torokhov, Linux Input, Sergei Kolzun
[-- Attachment #1: Type: text/plain, Size: 844 bytes --]
On Sat, 12 Mar 2011 21:49:05 +0100 (CET), Jiri Kosina <jkosina@suse.cz> wrote:
> On Fri, 11 Mar 2011, Dmitry Torokhov wrote:
> > 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.
>
> Applied, thanks guys.
Excellent, thanks! I'll remove the workaround from future versions of the
joystick package in Debian and Ubuntu.
Would it be possibke to submit this patch to stable too, so that it can make
it into distribution kernels sooner rather than later?
Regards,
Stephen
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-16 19:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11 8:27 [PATCH] HID: ACRUX - activate the device immediately after binding Dmitry Torokhov
2011-03-12 20:49 ` Jiri Kosina
2011-03-16 19:13 ` Stephen Kitt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).