From 24985cf68612a5617d396b0b188cec807641cde1 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Fri, 13 Nov 2009 10:45:53 +0100 Subject: HID: support Logitech/3DConnexion SpaceTraveler and SpaceNavigator These devices wrongly report their axes as relative instead of absolute. Fix this in up report descriptor of the device before it enters the parser. Reported-by: simon.windows@gmail.com Signed-off-by: Jiri Kosina --- drivers/hid/hid-lg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/hid/hid-lg.c') diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 0f870a3243ed..8e28f1dc40a6 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c @@ -33,6 +33,7 @@ #define LG_NOGET 0x100 #define LG_FF 0x200 #define LG_FF2 0x400 +#define LG_RDESC_REL_ABS 0x800 /* * Certain Logitech keyboards send in report #3 keys which are far @@ -51,6 +52,13 @@ static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[84] = rdesc[89] = 0x4d; rdesc[85] = rdesc[90] = 0x10; } + if ((quirks & LG_RDESC_REL_ABS) && rsize >= 50 && + rdesc[32] == 0x81 && rdesc[33] == 0x06 && + rdesc[49] == 0x81 && rdesc[50] == 0x06) { + dev_info(&hdev->dev, "fixing up rel/abs in Logitech " + "report descriptor\n"); + rdesc[33] = rdesc[50] = 0x02; + } } #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ @@ -303,8 +311,13 @@ static const struct hid_device_id lg_devices[] = { .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), .driver_data = LG_FF2 }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), + .driver_data = LG_RDESC_REL_ABS }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER), + .driver_data = LG_RDESC_REL_ABS }, { } }; + MODULE_DEVICE_TABLE(hid, lg_devices); static struct hid_driver lg_driver = { -- cgit v1.2.3 From 66d61bec697e99476c2fb095f9a6ead3be2e1c21 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Tue, 24 Nov 2009 18:22:20 +0100 Subject: HID: make Media key on Logitech DiNovo Mini work Put proper mapping of Media key on Logitech DiNovo Mini. According to the specification from Logitech webpage, this key is intended to launch a Media center. Reported-by: Stefan Plattner Signed-off-by: Jiri Kosina --- drivers/hid/hid-lg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/hid/hid-lg.c') diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 0f870a3243ed..4a489785647a 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c @@ -89,6 +89,22 @@ static int lg_ultrax_remote_mapping(struct hid_input *hi, return 1; } +static int lg_dinovo_mapping(struct hid_input *hi, struct hid_usage *usage, + unsigned long **bit, int *max) +{ + if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) + return 0; + + switch (usage->hid & HID_USAGE) { + + case 0x00d: lg_map_key_clear(KEY_MEDIA); break; + default: + return 0; + + } + return 1; +} + static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage, unsigned long **bit, int *max) { @@ -164,6 +180,10 @@ static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi, lg_ultrax_remote_mapping(hi, usage, bit, max)) return 1; + if (hdev->product == USB_DEVICE_ID_DINOVO_MINI && + lg_dinovo_mapping(hi, usage, bit, max)) + return 1; + if ((quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max)) return 1; -- cgit v1.2.3