HID: hid-debug: Show rdesc for unclaimed devices
authorHenrik Rydberg <rydberg@bitmath.se>
Tue, 21 Aug 2012 18:22:44 +0000 (20:22 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 27 Aug 2012 15:01:21 +0000 (08:01 -0700)
Since commit a7197c2e, the raw report descriptor is available also for
unclaimed devices. This patchs make it show in the rdesc debugfs node.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-debug.c

index 01dd9a7daf7a7f27d58599ee2d1315210239a7da..933fff0fff1ffc1f2dce372eeb0f6905688a947c 100644 (file)
@@ -911,15 +911,21 @@ static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
 
 }
 
-
 static int hid_debug_rdesc_show(struct seq_file *f, void *p)
 {
        struct hid_device *hdev = f->private;
+       const __u8 *rdesc = hdev->rdesc;
+       unsigned rsize = hdev->rsize;
        int i;
 
+       if (!rdesc) {
+               rdesc = hdev->dev_rdesc;
+               rsize = hdev->dev_rsize;
+       }
+
        /* dump HID report descriptor */
-       for (i = 0; i < hdev->rsize; i++)
-               seq_printf(f, "%02x ", hdev->rdesc[i]);
+       for (i = 0; i < rsize; i++)
+               seq_printf(f, "%02x ", rdesc[i]);
        seq_printf(f, "\n\n");
 
        /* dump parsed data and input mappings */