Commit 92d9e6e607eb7f8f1d2a43935f45cf300cf6fdf8

Authored by Jiri Kosina
1 parent 5fce620c0c

HID: support for Petalynx Maxter remote control

Petalynx Maxter remote control [1] 0x18b1/0x0037 emits 0xfa and 0xfc from
consumer page (reserved in HUT 1.12) for back and more keys. It also emits
a few usages from LOGIVENDOR page, which need adding.

Also, this device has broken report descriptor - the reported maximum is too
low - it doesn't contain the range for 'back' and 'more' keys, so we need to
bump it up before the report descriptor is being parsed.

Besides all this, it also requires NOGET quirk.

This patch does so.

[1] http://www.elmak.pl/index.php?option=com_phpshop&page=shop.browse&category_id=14&ext=opis&lang=en

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Showing 4 changed files with 39 additions and 2 deletions Side-by-side Diff

drivers/hid/hid-input.c
... ... @@ -566,6 +566,11 @@
566 566 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
567 567 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
568 568 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
  569 +
  570 + /* reserved in HUT 1.12. Reported on Petalynx remote */
  571 + case 0x0f6: map_key_clear(KEY_NEXT); break;
  572 + case 0x0fa: map_key_clear(KEY_BACK); break;
  573 +
569 574 case 0x183: map_key_clear(KEY_CONFIG); break;
570 575 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
571 576 case 0x185: map_key_clear(KEY_EDITOR); break;
572 577  
... ... @@ -727,10 +732,10 @@
727 732 }
728 733 break;
729 734  
730   - case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */
731   -
  735 + case HID_UP_LOGIVENDOR:
732 736 set_bit(EV_REP, input->evbit);
733 737 switch(usage->hid & HID_USAGE) {
  738 + /* Reported on Logitech Ultra X Media Remote */
734 739 case 0x004: map_key_clear(KEY_AGAIN); break;
735 740 case 0x00d: map_key_clear(KEY_HOME); break;
736 741 case 0x024: map_key_clear(KEY_SHUFFLE); break;
... ... @@ -748,6 +753,14 @@
748 753 case 0x04d: map_key_clear(KEY_SUBTITLE); break;
749 754 case 0x051: map_key_clear(KEY_RED); break;
750 755 case 0x052: map_key_clear(KEY_CLOSE); break;
  756 +
  757 + /* Reported on Petalynx Maxter remote */
  758 + case 0x05a: map_key_clear(KEY_TEXT); break;
  759 + case 0x05b: map_key_clear(KEY_RED); break;
  760 + case 0x05c: map_key_clear(KEY_GREEN); break;
  761 + case 0x05d: map_key_clear(KEY_YELLOW); break;
  762 + case 0x05e: map_key_clear(KEY_BLUE); break;
  763 +
751 764 default: goto ignore;
752 765 }
753 766 break;
drivers/hid/usbhid/hid-core.c
... ... @@ -688,6 +688,21 @@
688 688 }
689 689 }
690 690  
  691 +/* Petalynx Maxter Remote has maximum for consumer page set too low */
  692 +static void hid_fixup_petalynx_descriptor(unsigned char *rdesc, int rsize)
  693 +{
  694 + if (rsize >= 60 && rdesc[39] == 0x2a
  695 + && rdesc[40] == 0xf5
  696 + && rdesc[41] == 0x00
  697 + && rdesc[59] == 0x26
  698 + && rdesc[60] == 0xf9
  699 + && rdesc[61] == 0x00) {
  700 + info("Fixing up Petalynx Maxter Remote report descriptor");
  701 + rdesc[60] = 0xfa;
  702 + rdesc[40] = 0xfa;
  703 + }
  704 +}
  705 +
691 706 /*
692 707 * Some USB barcode readers from cypress have usage min and usage max in
693 708 * the wrong order
... ... @@ -780,6 +795,9 @@
780 795  
781 796 if (quirks & HID_QUIRK_SWAPPED_MIN_MAX)
782 797 hid_fixup_cypress_descriptor(rdesc, rsize);
  798 +
  799 + if (quirks & HID_QUIRK_PETALYNX_DESCRIPTOR)
  800 + hid_fixup_petalynx_descriptor(rdesc, rsize);
783 801  
784 802 #ifdef CONFIG_HID_DEBUG
785 803 printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = ", rsize, n);
drivers/hid/usbhid/hid-quirks.c
... ... @@ -226,6 +226,9 @@
226 226 #define USB_VENDOR_ID_PANTHERLORD 0x0810
227 227 #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001
228 228  
  229 +#define USB_VENDOR_ID_PETALYNX 0x18b1
  230 +#define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
  231 +
229 232 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43
230 233 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003
231 234  
... ... @@ -425,6 +428,8 @@
425 428  
426 429 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
427 430 { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
  431 +
  432 + { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_PETALYNX_DESCRIPTOR | HID_QUIRK_NOGET },
428 433  
429 434 { USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER, HID_QUIRK_SONY_PS3_CONTROLLER },
430 435  
... ... @@ -277,6 +277,7 @@
277 277 #define HID_QUIRK_RESET_LEDS 0x00400000
278 278 #define HID_QUIRK_SWAPPED_MIN_MAX 0x00800000
279 279 #define HID_QUIRK_HIDINPUT 0x01000000
  280 +#define HID_QUIRK_PETALYNX_DESCRIPTOR 0x02000000
280 281  
281 282 /*
282 283 * This is the global environment of the parser. This information is