RE: [PATCH] HID: added new driver for Panasonic Elite Panaboard UB-T780 and UB-T880
flat view
From: Anton Chikin <hidden>
Date: 2011-02-08 13:55:05
Also in:
lkml
Hi Henrik, Few words about usbhid_submit_report() usage, which seems to be wrong:
quoted hunk ↗ jump to hunk
+static int ubt880_switch_mode(struct hid_device *hid, unsigned char +mode) { + int rc = 0; + + struct hid_report *report = NULL; + struct hid_report *report_cur = NULL; + __s32 *val = NULL; + /** Packet forming */ + + UBT_DUMMY_DEBUG + + list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) + { + if (hid->report_enum[HID_FEATURE_REPORT].numbered) { + report_cur = report; + } + } + + if (report_cur == NULL) { + if (ubt_debug) + printk(KERN_DEBUG "ubt880 : switch mode : report_cur = 0"); + return rc; + } + + if (ubt_debug) + printk(KERN_DEBUG "ubt880: switch mode: reportid = %d", report_cur->id); + val = report_cur->field[0]->value; + + switch (mode) { + case MODE_MOUSE: { + mode = 0x0; + break; + } + case MODE_SINGLETOUCH: { + mode = 0x01; + break; + } + case MODE_DGTZR: { + mode = 0x02; + break; + } + default: { + rc = -EIO; + return rc; + } + } + val[0] = mode; + UBT_DUMMY_DEBUG + if (ubt_debug) + printk(KERN_DEBUG "ubt880 :switch_mode: usbhid_submit_report drv=%p p=%p mode=%d", hid, report_cur, mode); + /*Send report to device*/ + + usbhid_submit_report(hid, report_cur, USB_DIR_OUT); + UBT_DUMMY_DEBUG + return rc; +}
There ought to be a function in hid to help you achieve this.
I thought so, but I can't find anything suitable. There are functions in usbhid to work with leds and nothing else. On the other hand - Linux Cross Referencer reports heavy usage of usbhid_submit_report() in hid drivers. With best regards, Anton