⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hid-quirks.c

📁 omap3 linux 2.6 用nocc去除了冗余代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE },	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER, HID_QUIRK_LOGITECH_DESCRIPTOR },	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER, HID_QUIRK_LOGITECH_DESCRIPTOR },	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2, HID_QUIRK_LOGITECH_DESCRIPTOR },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },	{ USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },	{ USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },	{ USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER, HID_QUIRK_SONY_PS3_CONTROLLER },	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },	{ USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },	{ USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_SWAPPED_MIN_MAX },	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_SWAPPED_MIN_MAX },	{ 0, 0 }};/* Dynamic HID quirks list - specified at runtime */struct quirks_list_struct {	struct hid_blacklist hid_bl_item;	struct list_head node;};static LIST_HEAD(dquirks_list);static DECLARE_RWSEM(dquirks_rwsem);/* Runtime ("dynamic") quirks manipulation functions *//** * usbhid_exists_dquirk: find any dynamic quirks for a USB HID device * @idVendor: the 16-bit USB vendor ID, in native byteorder * @idProduct: the 16-bit USB product ID, in native byteorder * * Description: *         Scans dquirks_list for a matching dynamic quirk and returns *         the pointer to the relevant struct hid_blacklist if found. *         Must be called with a read lock held on dquirks_rwsem. * * Returns: NULL if no quirk found, struct hid_blacklist * if found. */static struct hid_blacklist *usbhid_exists_dquirk(const u16 idVendor,		const u16 idProduct){	struct quirks_list_struct *q;	struct hid_blacklist *bl_entry = NULL;	list_for_each_entry(q, &dquirks_list, node) {		if (q->hid_bl_item.idVendor == idVendor &&				q->hid_bl_item.idProduct == idProduct) {			bl_entry = &q->hid_bl_item;			break;		}	}	if (bl_entry != NULL)		dbg("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n",				bl_entry->quirks, bl_entry->idVendor,				bl_entry->idProduct);	return bl_entry;}/** * usbhid_modify_dquirk: add/replace a HID quirk * @idVendor: the 16-bit USB vendor ID, in native byteorder * @idProduct: the 16-bit USB product ID, in native byteorder * @quirks: the u32 quirks value to add/replace * * Description: *         If an dynamic quirk exists in memory for this (idVendor, *         idProduct) pair, replace its quirks value with what was *         provided.  Otherwise, add the quirk to the dynamic quirks list. * * Returns: 0 OK, -error on failure. */int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct,		const u32 quirks){	struct quirks_list_struct *q_new, *q;	int list_edited = 0;	if (!idVendor) {		dbg("Cannot add a quirk with idVendor = 0");		return -EINVAL;	}	q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL);	if (!q_new) {		dbg("Could not allocate quirks_list_struct");		return -ENOMEM;	}	q_new->hid_bl_item.idVendor = idVendor;	q_new->hid_bl_item.idProduct = idProduct;	q_new->hid_bl_item.quirks = quirks;	down_write(&dquirks_rwsem);	list_for_each_entry(q, &dquirks_list, node) {		if (q->hid_bl_item.idVendor == idVendor &&				q->hid_bl_item.idProduct == idProduct) {			list_replace(&q->node, &q_new->node);			kfree(q);			list_edited = 1;			break;		}	}	if (!list_edited)		list_add_tail(&q_new->node, &dquirks_list);	up_write(&dquirks_rwsem);	return 0;}/** * usbhid_remove_all_dquirks: remove all runtime HID quirks from memory * * Description: *         Free all memory associated with dynamic quirks - called before *         module unload. * */static void usbhid_remove_all_dquirks(void){	struct quirks_list_struct *q, *temp;	down_write(&dquirks_rwsem);	list_for_each_entry_safe(q, temp, &dquirks_list, node) {		list_del(&q->node);		kfree(q);	}	up_write(&dquirks_rwsem);}/**  * usbhid_quirks_init: apply USB HID quirks specified at module load time */int usbhid_quirks_init(char **quirks_param){	u16 idVendor, idProduct;	u32 quirks;	int n = 0, m;	for (; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) {		m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x",				&idVendor, &idProduct, &quirks);		if (m != 3 ||				usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) {			printk(KERN_WARNING					"Could not parse HID quirk module param %s\n",					quirks_param[n]);		}	}	return 0;}/** * usbhid_quirks_exit: release memory associated with dynamic_quirks * * Description: *     Release all memory associated with dynamic quirks.  Called upon *     module unload. * * Returns: nothing */void usbhid_quirks_exit(void){	usbhid_remove_all_dquirks();}/** * usbhid_exists_squirk: return any static quirks for a USB HID device * @idVendor: the 16-bit USB vendor ID, in native byteorder * @idProduct: the 16-bit USB product ID, in native byteorder * * Description: *     Given a USB vendor ID and product ID, return a pointer to *     the hid_blacklist entry associated with that device. * * Returns: pointer if quirk found, or NULL if no quirks found. */static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor,		const u16 idProduct){	const struct hid_blacklist *bl_entry = NULL;	int n = 0;	for (; hid_blacklist[n].idVendor; n++)		if (hid_blacklist[n].idVendor == idVendor &&				hid_blacklist[n].idProduct == idProduct)			bl_entry = &hid_blacklist[n];	if (bl_entry != NULL)		dbg("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n",				bl_entry->quirks, bl_entry->idVendor, 				bl_entry->idProduct);	return bl_entry;}/** * usbhid_lookup_quirk: return any quirks associated with a USB HID device * @idVendor: the 16-bit USB vendor ID, in native byteorder * @idProduct: the 16-bit USB product ID, in native byteorder * * Description: *     Given a USB vendor ID and product ID, return any quirks associated *     with that device. * * Returns: a u32 quirks value. */u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct){	u32 quirks = 0;	const struct hid_blacklist *bl_entry = NULL;	/* Ignore all Wacom devices */	if (idVendor == USB_VENDOR_ID_WACOM)		return HID_QUIRK_IGNORE;	/* ignore all Code Mercenaries IOWarrior devices */	if (idVendor == USB_VENDOR_ID_CODEMERCS)		if (idProduct >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST &&				idProduct <= USB_DEVICE_ID_CODEMERCS_IOW_LAST)			return HID_QUIRK_IGNORE;	down_read(&dquirks_rwsem);	bl_entry = usbhid_exists_dquirk(idVendor, idProduct);	if (!bl_entry)		bl_entry = usbhid_exists_squirk(idVendor, idProduct);	if (bl_entry)		quirks = bl_entry->quirks;	up_read(&dquirks_rwsem);	return quirks;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -