aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2007-10-14 08:47:56 -0400
committerJiri Kosina <jkosina@suse.cz>2007-10-14 08:47:56 -0400
commitd057fd4cb892087955568a139d15eae4115a0174 (patch)
tree4fd631492ff8d2d78c394fd2b054175588a7d633 /drivers/hid/usbhid
parentbb6c8d8fa9b5587eea18078ce0bcf6bb2905789f (diff)
parent709d27c04f4eccbc99d57a5569bce028915a4345 (diff)
Merge branch 'hidraw' into for-linus
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/hid-core.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a34e0f098f63..b38e559b7a46 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -32,6 +32,7 @@
32#include <linux/hid.h> 32#include <linux/hid.h>
33#include <linux/hiddev.h> 33#include <linux/hiddev.h>
34#include <linux/hid-debug.h> 34#include <linux/hid-debug.h>
35#include <linux/hidraw.h>
35#include "usbhid.h" 36#include "usbhid.h"
36 37
37/* 38/*
@@ -639,6 +640,28 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
639 return 0; 640 return 0;
640} 641}
641 642
643static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count)
644{
645 struct usbhid_device *usbhid = hid->driver_data;
646 struct usb_device *dev = hid_to_usb_dev(hid);
647 struct usb_interface *intf = usbhid->intf;
648 struct usb_host_interface *interface = intf->cur_altsetting;
649 int ret;
650
651 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
652 HID_REQ_SET_REPORT,
653 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
654 cpu_to_le16(((HID_OUTPUT_REPORT + 1) << 8) | *buf),
655 interface->desc.bInterfaceNumber, buf + 1, count - 1,
656 USB_CTRL_SET_TIMEOUT);
657
658 /* count also the report id */
659 if (ret > 0)
660 ret++;
661
662 return ret;
663}
664
642static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) 665static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
643{ 666{
644 struct usbhid_device *usbhid = hid->driver_data; 667 struct usbhid_device *usbhid = hid->driver_data;
@@ -882,6 +905,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
882 hid->hiddev_hid_event = hiddev_hid_event; 905 hid->hiddev_hid_event = hiddev_hid_event;
883 hid->hiddev_report_event = hiddev_report_event; 906 hid->hiddev_report_event = hiddev_report_event;
884#endif 907#endif
908 hid->hid_output_raw_report = usbhid_output_raw_report;
885 return hid; 909 return hid;
886 910
887fail: 911fail:
@@ -920,6 +944,8 @@ static void hid_disconnect(struct usb_interface *intf)
920 hidinput_disconnect(hid); 944 hidinput_disconnect(hid);
921 if (hid->claimed & HID_CLAIMED_HIDDEV) 945 if (hid->claimed & HID_CLAIMED_HIDDEV)
922 hiddev_disconnect(hid); 946 hiddev_disconnect(hid);
947 if (hid->claimed & HID_CLAIMED_HIDRAW)
948 hidraw_disconnect(hid);
923 949
924 usb_free_urb(usbhid->urbin); 950 usb_free_urb(usbhid->urbin);
925 usb_free_urb(usbhid->urbctrl); 951 usb_free_urb(usbhid->urbctrl);
@@ -952,11 +978,13 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
952 hid->claimed |= HID_CLAIMED_INPUT; 978 hid->claimed |= HID_CLAIMED_INPUT;
953 if (!hiddev_connect(hid)) 979 if (!hiddev_connect(hid))
954 hid->claimed |= HID_CLAIMED_HIDDEV; 980 hid->claimed |= HID_CLAIMED_HIDDEV;
981 if (!hidraw_connect(hid))
982 hid->claimed |= HID_CLAIMED_HIDRAW;
955 983
956 usb_set_intfdata(intf, hid); 984 usb_set_intfdata(intf, hid);
957 985
958 if (!hid->claimed) { 986 if (!hid->claimed) {
959 printk ("HID device not claimed by input or hiddev\n"); 987 printk ("HID device claimed by neither input, hiddev nor hidraw\n");
960 hid_disconnect(intf); 988 hid_disconnect(intf);
961 return -ENODEV; 989 return -ENODEV;
962 } 990 }
@@ -972,10 +1000,16 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
972 1000
973 if (hid->claimed & HID_CLAIMED_INPUT) 1001 if (hid->claimed & HID_CLAIMED_INPUT)
974 printk("input"); 1002 printk("input");
975 if (hid->claimed == (HID_CLAIMED_INPUT | HID_CLAIMED_HIDDEV)) 1003 if ((hid->claimed & HID_CLAIMED_INPUT) && ((hid->claimed & HID_CLAIMED_HIDDEV) ||
1004 hid->claimed & HID_CLAIMED_HIDRAW))
976 printk(","); 1005 printk(",");
977 if (hid->claimed & HID_CLAIMED_HIDDEV) 1006 if (hid->claimed & HID_CLAIMED_HIDDEV)
978 printk("hiddev%d", hid->minor); 1007 printk("hiddev%d", hid->minor);
1008 if ((hid->claimed & HID_CLAIMED_INPUT) && (hid->claimed & HID_CLAIMED_HIDDEV) &&
1009 (hid->claimed & HID_CLAIMED_HIDRAW))
1010 printk(",");
1011 if (hid->claimed & HID_CLAIMED_HIDRAW)
1012 printk("hidraw%d", ((struct hidraw*)hid->hidraw)->minor);
979 1013
980 c = "Device"; 1014 c = "Device";
981 for (i = 0; i < hid->maxcollection; i++) { 1015 for (i = 0; i < hid->maxcollection; i++) {