Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ae43810 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Jiri Kosina
Browse files

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: default avatarSergei Kolzun <x0r@dv-life.ru>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent f635bd11
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -68,9 +68,15 @@ config HID_A4TECH
	---help---
	---help---
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.


config HID_ACRUX_FF
config HID_ACRUX
	tristate "ACRUX force feedback"
	tristate "ACRUX game controller support"
	depends on USB_HID
	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
	select INPUT_FF_MEMLESS
	---help---
	---help---
	Say Y here if you want to enable force feedback support for ACRUX
	Say Y here if you want to enable force feedback support for ACRUX
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ endif


obj-$(CONFIG_HID_3M_PCT)	+= hid-3m-pct.o
obj-$(CONFIG_HID_3M_PCT)	+= hid-3m-pct.o
obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.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_APPLE)		+= hid-apple.o
obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
obj-$(CONFIG_HID_CANDO)		+= hid-cando.o
obj-$(CONFIG_HID_CANDO)		+= hid-cando.o
+28 −3
Original line number Original line Diff line number Diff line
@@ -33,6 +33,8 @@
#include <linux/hid.h>
#include <linux/hid.h>


#include "hid-ids.h"
#include "hid-ids.h"

#ifdef CONFIG_HID_ACRUX_FF
#include "usbhid/usbhid.h"
#include "usbhid/usbhid.h"


struct axff_device {
struct axff_device {
@@ -109,6 +111,12 @@ static int axff_init(struct hid_device *hid)
	kfree(axff);
	kfree(axff);
	return error;
	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)
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);
			 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;
	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[] = {
static const struct hid_device_id ax_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), },
	{ }
	{ }
@@ -152,6 +176,7 @@ static struct hid_driver ax_driver = {
	.name		= "acrux",
	.name		= "acrux",
	.id_table	= ax_devices,
	.id_table	= ax_devices,
	.probe		= ax_probe,
	.probe		= ax_probe,
	.remove		= ax_remove,
};
};


static int __init ax_init(void)
static int __init ax_init(void)
+0 −2
Original line number Original line Diff line number Diff line
@@ -1289,9 +1289,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_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_X5_005D) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
	{ 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) },
	{ 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_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_IRCONTROL4) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },