Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina: - Workaround for device ID conflict between Masterkit MA901 usb radio device and Atmel V-USB devices, to avoid regressions from older kernels, by Alexey Klimov - fix for possible race during input device registration in magicmouse driver, by Benjamin Tissoires * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: magicmouse: fix race between input_register() and probe() media: radio-ma901: return ENODEV in probe if usb_device doesn't match HID: fix Masterkit MA901 hid quirks
This commit is contained in:
commit
014642cb0a
4 changed files with 45 additions and 13 deletions
|
@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = {
|
|||
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
|
||||
|
@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev)
|
|||
hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST))
|
||||
return true;
|
||||
break;
|
||||
case USB_VENDOR_ID_ATMEL_V_USB:
|
||||
/* Masterkit MA901 usb radio based on Atmel tiny85 chip and
|
||||
* it has the same USB ID as many Atmel V-USB devices. This
|
||||
* usb radio is handled by radio-ma901.c driver so we want
|
||||
* ignore the hid. Check the name, bus, product and ignore
|
||||
* if we have MA901 usb radio.
|
||||
*/
|
||||
if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB &&
|
||||
hdev->bus == BUS_USB &&
|
||||
strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hdev->type == HID_TYPE_USBMOUSE &&
|
||||
|
|
|
@ -158,6 +158,8 @@
|
|||
#define USB_VENDOR_ID_ATMEL 0x03eb
|
||||
#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
|
||||
#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118
|
||||
#define USB_VENDOR_ID_ATMEL_V_USB 0x16c0
|
||||
#define USB_DEVICE_ID_ATMEL_V_USB 0x05df
|
||||
|
||||
#define USB_VENDOR_ID_AUREAL 0x0755
|
||||
#define USB_DEVICE_ID_AUREAL_W01RN 0x2626
|
||||
|
@ -557,9 +559,6 @@
|
|||
#define USB_VENDOR_ID_MADCATZ 0x0738
|
||||
#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
|
||||
|
||||
#define USB_VENDOR_ID_MASTERKIT 0x16c0
|
||||
#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
|
||||
|
||||
#define USB_VENDOR_ID_MCC 0x09db
|
||||
#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
|
||||
#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
|
||||
|
|
|
@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void magicmouse_input_configured(struct hid_device *hdev,
|
||||
struct hid_input *hi)
|
||||
|
||||
{
|
||||
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
|
||||
|
||||
int ret = magicmouse_setup_input(msc->input, hdev);
|
||||
if (ret) {
|
||||
hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
|
||||
/* clean msc->input to notify probe() of the failure */
|
||||
msc->input = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int magicmouse_probe(struct hid_device *hdev,
|
||||
const struct hid_device_id *id)
|
||||
{
|
||||
|
@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev,
|
|||
goto err_free;
|
||||
}
|
||||
|
||||
/* We do this after hid-input is done parsing reports so that
|
||||
* hid-input uses the most natural button and axis IDs.
|
||||
*/
|
||||
if (msc->input) {
|
||||
ret = magicmouse_setup_input(msc->input, hdev);
|
||||
if (ret) {
|
||||
hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
|
||||
goto err_stop_hw;
|
||||
}
|
||||
if (!msc->input) {
|
||||
hid_err(hdev, "magicmouse input not registered\n");
|
||||
ret = -ENOMEM;
|
||||
goto err_stop_hw;
|
||||
}
|
||||
|
||||
if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
|
||||
|
@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = {
|
|||
.remove = magicmouse_remove,
|
||||
.raw_event = magicmouse_raw_event,
|
||||
.input_mapping = magicmouse_input_mapping,
|
||||
.input_configured = magicmouse_input_configured,
|
||||
};
|
||||
module_hid_driver(magicmouse_driver);
|
||||
|
||||
|
|
|
@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev)
|
|||
static int usb_ma901radio_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct usb_device *dev = interface_to_usbdev(intf);
|
||||
struct ma901radio_device *radio;
|
||||
int retval = 0;
|
||||
|
||||
/* Masterkit MA901 usb radio has the same USB ID as many others
|
||||
* Atmel V-USB devices. Let's make additional checks to be sure
|
||||
* that this is our device.
|
||||
*/
|
||||
|
||||
if (dev->product && dev->manufacturer &&
|
||||
(strncmp(dev->product, "MA901", 5) != 0
|
||||
|| strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
|
||||
return -ENODEV;
|
||||
|
||||
radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
|
||||
if (!radio) {
|
||||
dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");
|
||||
|
|
Loading…
Reference in a new issue