Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid:
HID: fix Logitech DiNovo Edge touchwheel and Logic3 /SpectraVideo middle button
HID: add git tree information to MAINTAINERS
HID: fix broken Logitech S510 keyboard report descriptor; make extra keys work
HID: fix possible double-free on error path in hid parser
HID: hid-debug.c should #include <linux/hid-debug.h>
HID: fix bug in zeroing the last field byte in output reports
USB HID: use CONFIG_HID_DEBUG for outputting report descriptor
USB HID: Fix USB vendor and product IDs endianness for USB HID devices

+67 -21
+2
MAINTAINERS
··· 1492 1492 P: Jiri Kosina 1493 1493 M: jkosina@suse.cz 1494 1494 L: linux-input@atrey.karlin.mff.cuni.cz 1495 + T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 1495 1496 S: Maintained 1496 1497 1497 1498 HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS ··· 3424 3423 P: Jiri Kosina 3425 3424 M: jkosina@suse.cz 3426 3425 L: linux-usb-devel@lists.sourceforge.net 3426 + T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 3427 3427 S: Maintained 3428 3428 3429 3429 USB HUB DRIVER
+1 -6
drivers/hid/hid-core.c
··· 667 667 668 668 if (item.format != HID_ITEM_FORMAT_SHORT) { 669 669 dbg("unexpected long global item"); 670 - kfree(device->collection); 671 670 hid_free_device(device); 672 671 kfree(parser); 673 672 return NULL; ··· 675 676 if (dispatch_type[item.type](parser, &item)) { 676 677 dbg("item %u %u %u %u parsing failed\n", 677 678 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 678 - kfree(device->collection); 679 679 hid_free_device(device); 680 680 kfree(parser); 681 681 return NULL; ··· 683 685 if (start == end) { 684 686 if (parser->collection_stack_ptr) { 685 687 dbg("unbalanced collection at end of report description"); 686 - kfree(device->collection); 687 688 hid_free_device(device); 688 689 kfree(parser); 689 690 return NULL; 690 691 } 691 692 if (parser->local.delimiter_depth) { 692 693 dbg("unbalanced delimiter at end of report description"); 693 - kfree(device->collection); 694 694 hid_free_device(device); 695 695 kfree(parser); 696 696 return NULL; ··· 699 703 } 700 704 701 705 dbg("item fetching failed at offset %d\n", (int)(end - start)); 702 - kfree(device->collection); 703 706 hid_free_device(device); 704 707 kfree(parser); 705 708 return NULL; ··· 875 880 876 881 /* make sure the unused bits in the last byte are zeros */ 877 882 if (count > 0 && size > 0) 878 - data[(count*size-1)/8] = 0; 883 + data[(offset+count*size-1)/8] = 0; 879 884 880 885 for (n = 0; n < count; n++) { 881 886 if (field->logical_minimum < 0) /* signed values */
+1
drivers/hid/hid-debug.c
··· 29 29 */ 30 30 31 31 #include <linux/hid.h> 32 + #include <linux/hid-debug.h> 32 33 33 34 struct hid_usage_entry { 34 35 unsigned page;
+31 -6
drivers/hid/hid-input.c
··· 2 2 * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $ 3 3 * 4 4 * Copyright (c) 2000-2001 Vojtech Pavlik 5 - * Copyright (c) 2006 Jiri Kosina 5 + * Copyright (c) 2006-2007 Jiri Kosina 6 6 * 7 7 * HID to Linux Input mapping 8 8 */ ··· 71 71 #define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0) 72 72 73 73 #define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0) 74 - #define map_rel_clear(c) do { map_rel(c); clear_bit(c, bit); } while (0) 75 74 #define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0) 76 75 77 76 #ifdef CONFIG_USB_HIDINPUT_POWERBOOK ··· 295 296 } 296 297 } 297 298 298 - map_key_clear(code); 299 + map_key(code); 299 300 break; 300 301 301 302 ··· 346 347 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 347 348 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: 348 349 if (field->flags & HID_MAIN_ITEM_RELATIVE) 349 - map_rel_clear(usage->hid & 0xf); 350 + map_rel(usage->hid & 0xf); 350 351 else 351 - map_abs_clear(usage->hid & 0xf); 352 + map_abs(usage->hid & 0xf); 352 353 break; 353 354 354 355 case HID_GD_HATSWITCH: ··· 518 519 case 0x22f: map_key_clear(KEY_ZOOMRESET); break; 519 520 case 0x233: map_key_clear(KEY_SCROLLUP); break; 520 521 case 0x234: map_key_clear(KEY_SCROLLDOWN); break; 521 - case 0x238: map_rel_clear(REL_HWHEEL); break; 522 + case 0x238: map_rel(REL_HWHEEL); break; 522 523 case 0x25f: map_key_clear(KEY_CANCEL); break; 523 524 case 0x279: map_key_clear(KEY_REDO); break; 524 525 ··· 530 531 case 0x301: map_key_clear(KEY_PROG1); break; 531 532 case 0x302: map_key_clear(KEY_PROG2); break; 532 533 case 0x303: map_key_clear(KEY_PROG3); break; 534 + 535 + /* Reported on Logitech S510 wireless keyboard */ 536 + case 0x101f: map_key_clear(KEY_ZOOMIN); break; 537 + case 0x1020: map_key_clear(KEY_ZOOMOUT); break; 538 + case 0x1021: map_key_clear(KEY_ZOOMRESET); break; 539 + /* this one is marked as 'Rotate' */ 540 + case 0x1028: map_key_clear(KEY_ANGLE); break; 541 + case 0x1029: map_key_clear(KEY_SHUFFLE); break; 542 + case 0x1041: map_key_clear(KEY_BATTERY); break; 543 + case 0x1042: map_key_clear(KEY_WORDPROCESSOR); break; 544 + case 0x1043: map_key_clear(KEY_SPREADSHEET); break; 545 + case 0x1044: map_key_clear(KEY_PRESENTATION); break; 546 + case 0x1045: map_key_clear(KEY_UNDO); break; 547 + case 0x1046: map_key_clear(KEY_REDO); break; 548 + case 0x1047: map_key_clear(KEY_PRINT); break; 549 + case 0x1048: map_key_clear(KEY_SAVE); break; 550 + case 0x1049: map_key_clear(KEY_PROG1); break; 551 + case 0x104a: map_key_clear(KEY_PROG2); break; 552 + case 0x104b: map_key_clear(KEY_PROG3); break; 553 + case 0x104c: map_key_clear(KEY_PROG4); break; 533 554 534 555 default: goto ignore; 535 556 } ··· 665 646 field->flags &= ~HID_MAIN_ITEM_RELATIVE; 666 647 667 648 set_bit(usage->type, input->evbit); 649 + 650 + if (device->quirks & HID_QUIRK_DUPLICATE_USAGES && 651 + (usage->type == EV_KEY || 652 + usage->type == EV_REL || 653 + usage->type == EV_ABS)) 654 + clear_bit(usage->code, bit); 668 655 669 656 while (usage->code <= max && test_and_set_bit(usage->code, bit)) 670 657 usage->code = find_next_zero_bit(bit, max + 1, usage->code);
+28 -7
drivers/usb/input/hid-core.c
··· 4 4 * Copyright (c) 1999 Andreas Gal 5 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 6 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 7 - * Copyright (c) 2006 Jiri Kosina 7 + * Copyright (c) 2006-2007 Jiri Kosina 8 8 */ 9 9 10 10 /* ··· 26 26 #include <asm/byteorder.h> 27 27 #include <linux/input.h> 28 28 #include <linux/wait.h> 29 - 30 - #undef DEBUG 31 - #undef DEBUG_DATA 32 29 33 30 #include <linux/usb.h> 34 31 ··· 755 758 756 759 #define USB_VENDOR_ID_LOGITECH 0x046d 757 760 #define USB_DEVICE_ID_LOGITECH_USB_RECEIVER 0xc101 761 + #define USB_DEVICE_ID_LOGITECH_USB_RECEIVER_2 0xc517 762 + #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 758 763 759 764 #define USB_VENDOR_ID_IMATION 0x0718 760 765 #define USB_DEVICE_ID_DISC_STAKKA 0xd000 ··· 776 777 __u16 idProduct; 777 778 unsigned quirks; 778 779 } hid_blacklist[] = { 780 + 781 + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE, HID_QUIRK_DUPLICATE_USAGES }, 779 782 780 783 { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01, HID_QUIRK_IGNORE }, 781 784 { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10, HID_QUIRK_IGNORE }, ··· 945 944 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 946 945 947 946 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, 947 + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER_2, HID_QUIRK_LOGITECH_S510_DESCRIPTOR }, 948 948 949 949 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 950 950 ··· 1043 1041 kfree(buf); 1044 1042 } 1045 1043 1044 + /* 1045 + * Logitech S510 keyboard sends in report #3 keys which are far 1046 + * above the logical maximum described in descriptor. This extends 1047 + * the original value of 0x28c of logical maximum to 0x104d 1048 + */ 1049 + static void hid_fixup_s510_descriptor(unsigned char *rdesc, int rsize) 1050 + { 1051 + if (rsize >= 90 && rdesc[83] == 0x26 1052 + && rdesc[84] == 0x8c 1053 + && rdesc[85] == 0x02) { 1054 + info("Fixing up Logitech S510 report descriptor"); 1055 + rdesc[84] = rdesc[89] = 0x4d; 1056 + rdesc[85] = rdesc[90] = 0x10; 1057 + } 1058 + } 1059 + 1046 1060 static struct hid_device *usb_hid_configure(struct usb_interface *intf) 1047 1061 { 1048 1062 struct usb_host_interface *interface = intf->cur_altsetting; ··· 1127 1109 if ((quirks & HID_QUIRK_CYMOTION)) 1128 1110 hid_fixup_cymotion_descriptor(rdesc, rsize); 1129 1111 1130 - #ifdef DEBUG_DATA 1112 + if (quirks & HID_QUIRK_LOGITECH_S510_DESCRIPTOR) 1113 + hid_fixup_s510_descriptor(rdesc, rsize); 1114 + 1115 + #ifdef CONFIG_HID_DEBUG 1131 1116 printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = ", rsize, n); 1132 1117 for (n = 0; n < rsize; n++) 1133 1118 printk(" %02x", (unsigned char) rdesc[n]); ··· 1246 1225 le16_to_cpu(dev->descriptor.idProduct)); 1247 1226 1248 1227 hid->bus = BUS_USB; 1249 - hid->vendor = dev->descriptor.idVendor; 1250 - hid->product = dev->descriptor.idProduct; 1228 + hid->vendor = le16_to_cpu(dev->descriptor.idVendor); 1229 + hid->product = le16_to_cpu(dev->descriptor.idProduct); 1251 1230 1252 1231 usb_make_path(dev, hid->phys, sizeof(hid->phys)); 1253 1232 strlcat(hid->phys, "/input", sizeof(hid->phys));
+4 -2
include/linux/hid.h
··· 6 6 * 7 7 * Copyright (c) 1999 Andreas Gal 8 8 * Copyright (c) 2000-2001 Vojtech Pavlik 9 - * Copyright (c) 2006 Jiri Kosina 9 + * Copyright (c) 2006-2007 Jiri Kosina 10 10 */ 11 11 12 12 /* ··· 267 267 #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000 268 268 #define HID_QUIRK_IGNORE_MOUSE 0x00040000 269 269 #define HID_QUIRK_SONY_PS3_CONTROLLER 0x00080000 270 + #define HID_QUIRK_LOGITECH_S510_DESCRIPTOR 0x00100000 271 + #define HID_QUIRK_DUPLICATE_USAGES 0x00200000 270 272 271 273 /* 272 274 * This is the global environment of the parser. This information is ··· 294 292 */ 295 293 296 294 #define HID_MAX_DESCRIPTOR_SIZE 4096 297 - #define HID_MAX_USAGES 1024 295 + #define HID_MAX_USAGES 8192 298 296 #define HID_DEFAULT_NUM_COLLECTIONS 16 299 297 300 298 struct hid_local {