diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-05-30 09:07:13 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2007-07-09 08:03:35 -0400 |
commit | 58037eb961f859607b161c50d9d4ecb374de1e8f (patch) | |
tree | c192854fa4cfc16cce272b800a0393e21429191e /drivers/hid/usbhid/hid-core.c | |
parent | 7dcca30a32aadb0520417521b0c44f42d09fe05c (diff) |
HID: make debugging output runtime-configurable
There have been many reports recently about broken HID devices, the
diagnosis of which required users to recompile their kernels in order
to be able to provide debugging output needed for coding a quirk for
a particular device.
This patch makes CONFIG_HID_DEBUG default y if !EMBEDDED and makes it
possible to control debugging output produced by HID code by supplying
'debug=1' module parameter.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid/hid-core.c')
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index d91b9dac6df..1eb2c64bc44 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -127,7 +127,7 @@ static void hid_reset(struct work_struct *work) | |||
127 | hid_io_error(hid); | 127 | hid_io_error(hid); |
128 | break; | 128 | break; |
129 | default: | 129 | default: |
130 | err("can't reset device, %s-%s/input%d, status %d", | 130 | err_hid("can't reset device, %s-%s/input%d, status %d", |
131 | hid_to_usb_dev(hid)->bus->bus_name, | 131 | hid_to_usb_dev(hid)->bus->bus_name, |
132 | hid_to_usb_dev(hid)->devpath, | 132 | hid_to_usb_dev(hid)->devpath, |
133 | usbhid->ifnum, rc); | 133 | usbhid->ifnum, rc); |
@@ -220,7 +220,7 @@ static void hid_irq_in(struct urb *urb) | |||
220 | if (status) { | 220 | if (status) { |
221 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 221 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
222 | if (status != -EPERM) { | 222 | if (status != -EPERM) { |
223 | err("can't resubmit intr, %s-%s/input%d, status %d", | 223 | err_hid("can't resubmit intr, %s-%s/input%d, status %d", |
224 | hid_to_usb_dev(hid)->bus->bus_name, | 224 | hid_to_usb_dev(hid)->bus->bus_name, |
225 | hid_to_usb_dev(hid)->devpath, | 225 | hid_to_usb_dev(hid)->devpath, |
226 | usbhid->ifnum, status); | 226 | usbhid->ifnum, status); |
@@ -240,10 +240,10 @@ static int hid_submit_out(struct hid_device *hid) | |||
240 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 240 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
241 | usbhid->urbout->dev = hid_to_usb_dev(hid); | 241 | usbhid->urbout->dev = hid_to_usb_dev(hid); |
242 | 242 | ||
243 | dbg("submitting out urb"); | 243 | dbg_hid("submitting out urb\n"); |
244 | 244 | ||
245 | if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { | 245 | if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { |
246 | err("usb_submit_urb(out) failed"); | 246 | err_hid("usb_submit_urb(out) failed"); |
247 | return -1; | 247 | return -1; |
248 | } | 248 | } |
249 | 249 | ||
@@ -287,12 +287,12 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
287 | usbhid->cr->wIndex = cpu_to_le16(usbhid->ifnum); | 287 | usbhid->cr->wIndex = cpu_to_le16(usbhid->ifnum); |
288 | usbhid->cr->wLength = cpu_to_le16(len); | 288 | usbhid->cr->wLength = cpu_to_le16(len); |
289 | 289 | ||
290 | dbg("submitting ctrl urb: %s wValue=0x%04x wIndex=0x%04x wLength=%u", | 290 | dbg_hid("submitting ctrl urb: %s wValue=0x%04x wIndex=0x%04x wLength=%u\n", |
291 | usbhid->cr->bRequest == HID_REQ_SET_REPORT ? "Set_Report" : "Get_Report", | 291 | usbhid->cr->bRequest == HID_REQ_SET_REPORT ? "Set_Report" : "Get_Report", |
292 | usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); | 292 | usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); |
293 | 293 | ||
294 | if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { | 294 | if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { |
295 | err("usb_submit_urb(ctrl) failed"); | 295 | err_hid("usb_submit_urb(ctrl) failed"); |
296 | return -1; | 296 | return -1; |
297 | } | 297 | } |
298 | 298 | ||
@@ -474,7 +474,7 @@ int usbhid_wait_io(struct hid_device *hid) | |||
474 | if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && | 474 | if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && |
475 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), | 475 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), |
476 | 10*HZ)) { | 476 | 10*HZ)) { |
477 | dbg("timeout waiting for ctrl or out queue to clear"); | 477 | dbg_hid("timeout waiting for ctrl or out queue to clear\n"); |
478 | return -1; | 478 | return -1; |
479 | } | 479 | } |
480 | 480 | ||
@@ -667,7 +667,7 @@ static void hid_fixup_sony_ps3_controller(struct usb_device *dev, int ifnum) | |||
667 | USB_CTRL_GET_TIMEOUT); | 667 | USB_CTRL_GET_TIMEOUT); |
668 | 668 | ||
669 | if (result < 0) | 669 | if (result < 0) |
670 | err("%s failed: %d\n", __func__, result); | 670 | err_hid("%s failed: %d\n", __func__, result); |
671 | 671 | ||
672 | kfree(buf); | 672 | kfree(buf); |
673 | } | 673 | } |
@@ -746,7 +746,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
746 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && | 746 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && |
747 | (!interface->desc.bNumEndpoints || | 747 | (!interface->desc.bNumEndpoints || |
748 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { | 748 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { |
749 | dbg("class descriptor not present\n"); | 749 | dbg_hid("class descriptor not present\n"); |
750 | return NULL; | 750 | return NULL; |
751 | } | 751 | } |
752 | 752 | ||
@@ -755,19 +755,19 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
755 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); | 755 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); |
756 | 756 | ||
757 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { | 757 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { |
758 | dbg("weird size of report descriptor (%u)", rsize); | 758 | dbg_hid("weird size of report descriptor (%u)\n", rsize); |
759 | return NULL; | 759 | return NULL; |
760 | } | 760 | } |
761 | 761 | ||
762 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { | 762 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { |
763 | dbg("couldn't allocate rdesc memory"); | 763 | dbg_hid("couldn't allocate rdesc memory\n"); |
764 | return NULL; | 764 | return NULL; |
765 | } | 765 | } |
766 | 766 | ||
767 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); | 767 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); |
768 | 768 | ||
769 | if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { | 769 | if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { |
770 | dbg("reading report descriptor failed"); | 770 | dbg_hid("reading report descriptor failed\n"); |
771 | kfree(rdesc); | 771 | kfree(rdesc); |
772 | return NULL; | 772 | return NULL; |
773 | } | 773 | } |
@@ -781,15 +781,13 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
781 | if (quirks & HID_QUIRK_SWAPPED_MIN_MAX) | 781 | if (quirks & HID_QUIRK_SWAPPED_MIN_MAX) |
782 | hid_fixup_cypress_descriptor(rdesc, rsize); | 782 | hid_fixup_cypress_descriptor(rdesc, rsize); |
783 | 783 | ||
784 | #ifdef CONFIG_HID_DEBUG | 784 | dbg_hid("report descriptor (size %u, read %d) = ", rsize, n); |
785 | printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = ", rsize, n); | ||
786 | for (n = 0; n < rsize; n++) | 785 | for (n = 0; n < rsize; n++) |
787 | printk(" %02x", (unsigned char) rdesc[n]); | 786 | dbg_hid_line(" %02x", (unsigned char) rdesc[n]); |
788 | printk("\n"); | 787 | dbg_hid_line("\n"); |
789 | #endif | ||
790 | 788 | ||
791 | if (!(hid = hid_parse_report(rdesc, n))) { | 789 | if (!(hid = hid_parse_report(rdesc, n))) { |
792 | dbg("parsing report descriptor failed"); | 790 | dbg_hid("parsing report descriptor failed\n"); |
793 | kfree(rdesc); | 791 | kfree(rdesc); |
794 | return NULL; | 792 | return NULL; |
795 | } | 793 | } |
@@ -861,7 +859,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
861 | } | 859 | } |
862 | 860 | ||
863 | if (!usbhid->urbin) { | 861 | if (!usbhid->urbin) { |
864 | err("couldn't find an input interrupt endpoint"); | 862 | err_hid("couldn't find an input interrupt endpoint"); |
865 | goto fail; | 863 | goto fail; |
866 | } | 864 | } |
867 | 865 | ||
@@ -978,7 +976,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
978 | int i; | 976 | int i; |
979 | char *c; | 977 | char *c; |
980 | 978 | ||
981 | dbg("HID probe called for ifnum %d", | 979 | dbg_hid("HID probe called for ifnum %d\n", |
982 | intf->altsetting->desc.bInterfaceNumber); | 980 | intf->altsetting->desc.bInterfaceNumber); |
983 | 981 | ||
984 | if (!(hid = usb_hid_configure(intf))) | 982 | if (!(hid = usb_hid_configure(intf))) |