hid_probe
==>usb_hid_configure
==*>hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize) 读取鼠标或键盘的报告描述符report descriptor简写为rdesc
==*>usbhid_fixup_report_descriptor(le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct), rdesc,
rsize, rdesc_quirks_param);
// usbhid_fixup_report_descriptor函数
// 描述该vid+pid的report descriptor是否在rdesc黑名单里边,
// 如果在,那么该硬件产品存在报告描述符知名bug,使用hid_rdesc_blacklist和
// insmod usbhid.ko rdesc_quirks=vid:pid:quirks驱动插入时动态提供的rdesc_quirks_param修正数组中的[luther.gliethtp]
// 正确数值替换hid_get_class_descriptor读取到rdesc内存中的错误数值
// rdesc_quirks_param所有数值都在/sys/module/usbhid/parameters/rdesc_quirks文件中[luther.gliethtp]
/**
* usbhid_fixup_report_descriptor: check if report descriptor needs fixup
*
* Description:
* Walks the hid_rdesc_blacklist[] array and checks whether the device
* is known to have broken report descriptor that needs to be fixed up
* prior to entering the HID parser
*
* Returns: nothing
*/
void usbhid_fixup_report_descriptor(const u16 idVendor, const u16 idProduct,
char *rdesc, unsigned rsize, char **quirks_param)
{
int n, m;
u16 paramVendor, paramProduct;
u32 quirks;
/* static rdesc quirk entries */
for (n = 0; hid_rdesc_blacklist[n].idVendor; n++)
if (hid_rdesc_blacklist[n].idVendor == idVendor &&
hid_rdesc_blacklist[n].idProduct == idProduct)
__usbhid_fixup_report_descriptor(hid_rdesc_blacklist[n].quirks,
rdesc, rsize);
/* runtime rdesc quirk entries handling */
for (n = 0; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) {
m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x",
¶mVendor, ¶mProduct, &quirks);
if (m != 3)
printk(KERN_WARNING
"Could not parse HID quirk module param %s\n",
quirks_param[n]);
else if (paramVendor == idVendor && paramProduct == idProduct)
__usbhid_fixup_report_descriptor(quirks, rdesc, rsize);
}
}
阅读(1870) | 评论(0) | 转发(0) |