aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-26 18:04:24 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:56 -0400
commit93c10132a7ac160df3175b53f7ee857625412165 (patch)
tree64ea194ddd7791d44394bb2a918921a2906fe1ee /drivers/hid/usbhid
parentfea6f1833b5bbff7066bcde1fa1141c9717bbad2 (diff)
HID: move connect quirks
Move connecting from usbhid to the hid layer and fix also hidp in that manner. This removes all the ignore/force hidinput/hiddev connecting quirks. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/hid-core.c76
-rw-r--r--drivers/hid/usbhid/hiddev.c20
2 files changed, 18 insertions, 78 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index b41d0110a75e..0513b60728d3 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -44,8 +44,6 @@
44#define DRIVER_DESC "USB HID core driver" 44#define DRIVER_DESC "USB HID core driver"
45#define DRIVER_LICENSE "GPL" 45#define DRIVER_LICENSE "GPL"
46 46
47static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
48 "Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};
49/* 47/*
50 * Module parameters. 48 * Module parameters.
51 */ 49 */
@@ -670,70 +668,6 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
670 usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma); 668 usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
671} 669}
672 670
673static int usbhid_start_finish(struct hid_device *hid)
674{
675 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
676 char path[64], *type;
677 unsigned int i;
678
679 usbhid_init_reports(hid);
680 hid_dump_device(hid);
681 if (hid->quirks & HID_QUIRK_RESET_LEDS)
682 usbhid_set_leds(hid);
683
684 if (!hidinput_connect(hid))
685 hid->claimed |= HID_CLAIMED_INPUT;
686 if (!hiddev_connect(hid))
687 hid->claimed |= HID_CLAIMED_HIDDEV;
688 if (!hidraw_connect(hid))
689 hid->claimed |= HID_CLAIMED_HIDRAW;
690
691 if (!hid->claimed) {
692 printk(KERN_ERR "HID device claimed by neither input, hiddev "
693 "nor hidraw\n");
694 return -ENODEV;
695 }
696
697 if ((hid->claimed & HID_CLAIMED_INPUT))
698 hid_ff_init(hid);
699
700 printk(KERN_INFO);
701
702 if (hid->claimed & HID_CLAIMED_INPUT)
703 printk("input");
704 if ((hid->claimed & HID_CLAIMED_INPUT) &&
705 ((hid->claimed & HID_CLAIMED_HIDDEV) ||
706 hid->claimed & HID_CLAIMED_HIDRAW))
707 printk(",");
708 if (hid->claimed & HID_CLAIMED_HIDDEV)
709 printk("hiddev%d", hid->minor);
710 if ((hid->claimed & HID_CLAIMED_INPUT) &&
711 (hid->claimed & HID_CLAIMED_HIDDEV) &&
712 (hid->claimed & HID_CLAIMED_HIDRAW))
713 printk(",");
714 if (hid->claimed & HID_CLAIMED_HIDRAW)
715 printk("hidraw%d", ((struct hidraw *)hid->hidraw)->minor);
716
717 type = "Device";
718 for (i = 0; i < hid->maxcollection; i++) {
719 if (hid->collection[i].type == HID_COLLECTION_APPLICATION &&
720 (hid->collection[i].usage & HID_USAGE_PAGE) ==
721 HID_UP_GENDESK &&
722 (hid->collection[i].usage & 0xffff) <
723 ARRAY_SIZE(hid_types)) {
724 type = hid_types[hid->collection[i].usage & 0xffff];
725 break;
726 }
727 }
728
729 usb_make_path(interface_to_usbdev(intf), path, 63);
730
731 printk(": USB HID v%x.%02x %s [%s] on %s\n",
732 hid->version >> 8, hid->version & 0xff, type, hid->name, path);
733
734 return 0;
735}
736
737static int usbhid_parse(struct hid_device *hid) 671static int usbhid_parse(struct hid_device *hid)
738{ 672{
739 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 673 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
@@ -923,9 +857,11 @@ static int usbhid_start(struct hid_device *hid)
923 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; 857 usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma;
924 usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); 858 usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
925 859
926 ret = usbhid_start_finish(hid); 860 usbhid_init_reports(hid);
927 if (ret) 861 hid_dump_device(hid);
928 goto fail; 862
863 if (hid->quirks & HID_QUIRK_RESET_LEDS)
864 usbhid_set_leds(hid);
929 865
930 return 0; 866 return 0;
931 867
@@ -1000,7 +936,9 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1000 usb_set_intfdata(intf, hid); 936 usb_set_intfdata(intf, hid);
1001 hid->ll_driver = &usb_hid_driver; 937 hid->ll_driver = &usb_hid_driver;
1002 hid->hid_output_raw_report = usbhid_output_raw_report; 938 hid->hid_output_raw_report = usbhid_output_raw_report;
939 hid->ff_init = hid_ff_init;
1003#ifdef CONFIG_USB_HIDDEV 940#ifdef CONFIG_USB_HIDDEV
941 hid->hiddev_connect = hiddev_connect;
1004 hid->hiddev_hid_event = hiddev_hid_event; 942 hid->hiddev_hid_event = hiddev_hid_event;
1005 hid->hiddev_report_event = hiddev_report_event; 943 hid->hiddev_report_event = hiddev_report_event;
1006#endif 944#endif
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 842e9edb888e..babd65dd46ad 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -790,21 +790,23 @@ static struct usb_class_driver hiddev_class = {
790/* 790/*
791 * This is where hid.c calls us to connect a hid device to the hiddev driver 791 * This is where hid.c calls us to connect a hid device to the hiddev driver
792 */ 792 */
793int hiddev_connect(struct hid_device *hid) 793int hiddev_connect(struct hid_device *hid, unsigned int force)
794{ 794{
795 struct hiddev *hiddev; 795 struct hiddev *hiddev;
796 struct usbhid_device *usbhid = hid->driver_data; 796 struct usbhid_device *usbhid = hid->driver_data;
797 int i;
798 int retval; 797 int retval;
799 798
800 for (i = 0; i < hid->maxcollection; i++) 799 if (!force) {
801 if (hid->collection[i].type == 800 unsigned int i;
802 HID_COLLECTION_APPLICATION && 801 for (i = 0; i < hid->maxcollection; i++)
803 !IS_INPUT_APPLICATION(hid->collection[i].usage)) 802 if (hid->collection[i].type ==
804 break; 803 HID_COLLECTION_APPLICATION &&
804 !IS_INPUT_APPLICATION(hid->collection[i].usage))
805 break;
805 806
806 if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0) 807 if (i == hid->maxcollection)
807 return -1; 808 return -1;
809 }
808 810
809 if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) 811 if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
810 return -1; 812 return -1;