亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hid-core.c

?? 優龍2410linux2.6.8內核源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* *  USB HID support for Linux * *  Copyright (c) 1999 Andreas Gal *  Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@suse.cz> *//* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. */#include <linux/module.h>#include <linux/slab.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/sched.h>#include <linux/list.h>#include <linux/mm.h>#include <linux/smp_lock.h>#include <linux/spinlock.h>#include <asm/unaligned.h>#include <asm/byteorder.h>#include <linux/input.h>#undef DEBUG#undef DEBUG_DATA#include <linux/usb.h>#include "hid.h"#include <linux/hiddev.h>/* * Version Information */#define DRIVER_VERSION "v2.0"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",				"Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};/* * Register a new report for a device. */static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id){	struct hid_report_enum *report_enum = device->report_enum + type;	struct hid_report *report;	if (report_enum->report_id_hash[id])		return report_enum->report_id_hash[id];	if (!(report = kmalloc(sizeof(struct hid_report), GFP_KERNEL)))		return NULL;	memset(report, 0, sizeof(struct hid_report));	if (id != 0)		report_enum->numbered = 1;	report->id = id;	report->type = type;	report->size = 0;	report->device = device;	report_enum->report_id_hash[id] = report;	list_add_tail(&report->list, &report_enum->report_list);	return report;}/* * Register a new field for this report. */static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values){	struct hid_field *field;	if (report->maxfield == HID_MAX_FIELDS) {		dbg("too many fields in report");		return NULL;	}	if (!(field = kmalloc(sizeof(struct hid_field) + usages * sizeof(struct hid_usage)		+ values * sizeof(unsigned), GFP_KERNEL))) return NULL;	memset(field, 0, sizeof(struct hid_field) + usages * sizeof(struct hid_usage)		+ values * sizeof(unsigned));	report->field[report->maxfield++] = field;	field->usage = (struct hid_usage *)(field + 1);	field->value = (unsigned *)(field->usage + usages);	field->report = report;	return field;}/* * Open a collection. The type/usage is pushed on the stack. */static int open_collection(struct hid_parser *parser, unsigned type){	struct hid_collection *collection;	unsigned usage;	usage = parser->local.usage[0];	if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) {		dbg("collection stack overflow");		return -1;	}	if (parser->device->maxcollection == parser->device->collection_size) {		collection = kmalloc(sizeof(struct hid_collection) *				     parser->device->collection_size * 2,				     GFP_KERNEL);		if (collection == NULL) {			dbg("failed to reallocate collection array");			return -1;		}		memcpy(collection, parser->device->collection,		       sizeof(struct hid_collection) *		       parser->device->collection_size);		memset(collection + parser->device->collection_size, 0,		       sizeof(struct hid_collection) *		       parser->device->collection_size);		kfree(parser->device->collection);		parser->device->collection = collection;		parser->device->collection_size *= 2;	}	parser->collection_stack[parser->collection_stack_ptr++] =		parser->device->maxcollection;	collection = parser->device->collection + 		parser->device->maxcollection++;	collection->type = type;	collection->usage = usage;	collection->level = parser->collection_stack_ptr - 1;		if (type == HID_COLLECTION_APPLICATION)		parser->device->maxapplication++;	return 0;}/* * Close a collection. */static int close_collection(struct hid_parser *parser){	if (!parser->collection_stack_ptr) {		dbg("collection stack underflow");		return -1;	}	parser->collection_stack_ptr--;	return 0;}/* * Climb up the stack, search for the specified collection type * and return the usage. */static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type){	int n;	for (n = parser->collection_stack_ptr - 1; n >= 0; n--)		if (parser->device->collection[parser->collection_stack[n]].type == type)			return parser->device->collection[parser->collection_stack[n]].usage;	return 0; /* we know nothing about this usage type */}/* * Add a usage to the temporary parser table. */static int hid_add_usage(struct hid_parser *parser, unsigned usage){	if (parser->local.usage_index >= HID_MAX_USAGES) {		dbg("usage index exceeded");		return -1;	}	parser->local.usage[parser->local.usage_index] = usage;	parser->local.collection_index[parser->local.usage_index] =		parser->collection_stack_ptr ? 		parser->collection_stack[parser->collection_stack_ptr - 1] : 0;	parser->local.usage_index++;	return 0;}/* * Register a new field for this report. */static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags){	struct hid_report *report;	struct hid_field *field;	int usages;	unsigned offset;	int i;	if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) {		dbg("hid_register_report failed");		return -1;	}	if (parser->global.logical_maximum < parser->global.logical_minimum) {		dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum);		return -1;	}	usages = parser->local.usage_index;	offset = report->size;	report->size += parser->global.report_size * parser->global.report_count;	if (usages < parser->global.report_count)		usages = parser->global.report_count;	if (usages == 0)		return 0; /* ignore padding fields */	if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL)		return 0;	field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);	field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL);	field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);	for (i = 0; i < usages; i++) {		int j = i;		/* Duplicate the last usage we parsed if we have excess values */		if (i >= parser->local.usage_index)			j = parser->local.usage_index - 1;		field->usage[i].hid = parser->local.usage[j];		field->usage[i].collection_index =			parser->local.collection_index[j];	}	field->maxusage = usages;	field->flags = flags;	field->report_offset = offset;	field->report_type = report_type;	field->report_size = parser->global.report_size;	field->report_count = parser->global.report_count;	field->logical_minimum = parser->global.logical_minimum;	field->logical_maximum = parser->global.logical_maximum;	field->physical_minimum = parser->global.physical_minimum;	field->physical_maximum = parser->global.physical_maximum;	field->unit_exponent = parser->global.unit_exponent;	field->unit = parser->global.unit;	return 0;}/* * Read data value from item. */static __inline__ __u32 item_udata(struct hid_item *item){	switch (item->size) {		case 1: return item->data.u8;		case 2: return item->data.u16;		case 4: return item->data.u32;	}	return 0;}static __inline__ __s32 item_sdata(struct hid_item *item){	switch (item->size) {		case 1: return item->data.s8;		case 2: return item->data.s16;		case 4: return item->data.s32;	}	return 0;}/* * Process a global item. */static int hid_parser_global(struct hid_parser *parser, struct hid_item *item){	switch (item->tag) {		case HID_GLOBAL_ITEM_TAG_PUSH:			if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) {				dbg("global enviroment stack overflow");				return -1;			}			memcpy(parser->global_stack + parser->global_stack_ptr++,				&parser->global, sizeof(struct hid_global));			return 0;		case HID_GLOBAL_ITEM_TAG_POP:			if (!parser->global_stack_ptr) {				dbg("global enviroment stack underflow");				return -1;			}			memcpy(&parser->global, parser->global_stack + --parser->global_stack_ptr,				sizeof(struct hid_global));			return 0;		case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:			parser->global.usage_page = item_udata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM:			parser->global.logical_minimum = item_sdata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM:			if (parser->global.logical_minimum < 0)				parser->global.logical_maximum = item_sdata(item);			else				parser->global.logical_maximum = item_udata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM:			parser->global.physical_minimum = item_sdata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM:			if (parser->global.physical_minimum < 0)				parser->global.physical_maximum = item_sdata(item);			else				parser->global.physical_maximum = item_udata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT:			parser->global.unit_exponent = item_sdata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_UNIT:			parser->global.unit = item_udata(item);			return 0;		case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:			if ((parser->global.report_size = item_udata(item)) > 32) {				dbg("invalid report_size %d", parser->global.report_size);				return -1;			}			return 0;		case HID_GLOBAL_ITEM_TAG_REPORT_COUNT:			if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) {				dbg("invalid report_count %d", parser->global.report_count);				return -1;			}			return 0;		case HID_GLOBAL_ITEM_TAG_REPORT_ID:			if ((parser->global.report_id = item_udata(item)) == 0) {				dbg("report_id 0 is invalid");				return -1;			}			return 0;		default:			dbg("unknown global tag 0x%x", item->tag);			return -1;	}}/* * Process a local item. */static int hid_parser_local(struct hid_parser *parser, struct hid_item *item){	__u32 data;	unsigned n;	if (item->size == 0) {		dbg("item data expected for local item");		return -1;	}	data = item_udata(item);	switch (item->tag) {		case HID_LOCAL_ITEM_TAG_DELIMITER:			if (data) {				/*				 * We treat items before the first delimiter				 * as global to all usage sets (branch 0).				 * In the moment we process only these global				 * items and the first delimiter set.				 */				if (parser->local.delimiter_depth != 0) {					dbg("nested delimiters");					return -1;				}				parser->local.delimiter_depth++;				parser->local.delimiter_branch++;			} else {				if (parser->local.delimiter_depth < 1) {					dbg("bogus close delimiter");					return -1;				}				parser->local.delimiter_depth--;			}			return 1;		case HID_LOCAL_ITEM_TAG_USAGE:			if (parser->local.delimiter_branch > 1) {				dbg("alternative usage ignored");				return 0;			}			if (item->size <= 2)				data = (parser->global.usage_page << 16) + data;			return hid_add_usage(parser, data);		case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:			if (parser->local.delimiter_branch > 1) {				dbg("alternative usage ignored");				return 0;			}			if (item->size <= 2)				data = (parser->global.usage_page << 16) + data;			parser->local.usage_minimum = data;			return 0;		case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:			if (parser->local.delimiter_branch > 1) {				dbg("alternative usage ignored");				return 0;			}			if (item->size <= 2)				data = (parser->global.usage_page << 16) + data;			for (n = parser->local.usage_minimum; n <= data; n++)				if (hid_add_usage(parser, n)) {					dbg("hid_add_usage failed\n");					return -1;				}

?? 快捷鍵說明

亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级电影网站| 中文字幕中文字幕一区| 香蕉久久一区二区不卡无毒影院| 99久久精品国产观看| 久久久精品欧美丰满| 国产一区激情在线| 国产亚洲一区二区在线观看| 国产精品亚洲人在线观看| 精品国产免费久久| 国产综合一区二区| 久久看人人爽人人| 国产成人av一区二区三区在线| 久久精品男人天堂av| 丁香网亚洲国际| 国产精品成人一区二区艾草| 色综合久久中文综合久久97| 洋洋成人永久网站入口| 欧美日韩午夜影院| 蜜臀av一区二区三区| 久久久久久电影| 不卡一二三区首页| 亚洲第一av色| 久久嫩草精品久久久久| 成人亚洲一区二区一| 亚洲狼人国产精品| 777色狠狠一区二区三区| 久久99精品一区二区三区| 国产欧美一区二区精品性色| 色欧美88888久久久久久影院| 一区2区3区在线看| 日韩女优毛片在线| 福利一区二区在线| 亚洲蜜臀av乱码久久精品蜜桃| 欧美夫妻性生活| 国产精品亚洲成人| 亚洲黄色性网站| 欧美大片顶级少妇| 91亚洲精品久久久蜜桃网站| 日韩av网站在线观看| 久久久久国产精品厨房| 色偷偷88欧美精品久久久| 青青草国产成人99久久| 国产精品丝袜在线| 在线播放日韩导航| 成人高清视频在线观看| 日韩精品久久理论片| 中文字幕不卡在线观看| 欧美一区三区二区| 99r精品视频| 国产综合色精品一区二区三区| 亚洲一区二区三区美女| 国产亚洲视频系列| 欧美妇女性影城| 91丨porny丨在线| 加勒比av一区二区| 亚洲国产精品久久人人爱| 中文字幕乱码亚洲精品一区| 日韩欧美在线网站| 91农村精品一区二区在线| 国产做a爰片久久毛片| 性做久久久久久免费观看欧美| 中文字幕一区在线观看视频| 精品久久久久久综合日本欧美| 精品视频一区二区不卡| www.亚洲激情.com| 国产伦精品一区二区三区免费| 丝瓜av网站精品一区二区| 亚洲激情欧美激情| 综合激情成人伊人| 欧美国产1区2区| 久久女同性恋中文字幕| 精品国产欧美一区二区| 日韩三级电影网址| 欧美日韩一二区| 韩国一区二区视频| 夜夜爽夜夜爽精品视频| 亚洲激情校园春色| 国产欧美日韩精品在线| 欧美一区三区四区| 欧美视频完全免费看| 成人h动漫精品一区二区| 久久av资源站| 亚洲欧美激情视频在线观看一区二区三区 | 高清不卡在线观看| 蜜臀av性久久久久蜜臀av麻豆| 自拍av一区二区三区| 久久久精品国产免费观看同学| 欧美美女视频在线观看| 色先锋资源久久综合| 成人a免费在线看| 久久精品国产精品亚洲精品| 另类的小说在线视频另类成人小视频在线 | 日韩亚洲电影在线| 欧美色综合网站| www.色精品| 国产69精品久久99不卡| 国产在线国偷精品产拍免费yy | 久久国产福利国产秒拍| 午夜精品久久久久久久久久 | 99久久99久久精品国产片果冻| 国产资源在线一区| 日韩国产高清影视| 亚洲国产精品欧美一二99| 夜夜揉揉日日人人青青一国产精品 | 另类调教123区 | 欧美刺激脚交jootjob| 欧美一级高清片在线观看| 宅男噜噜噜66一区二区66| 一本久道久久综合中文字幕| 日本精品免费观看高清观看| 91精品福利视频| 91麻豆高清视频| 欧美在线一二三四区| 色欧美日韩亚洲| 欧美日韩免费电影| 在线播放视频一区| 欧美成人三级电影在线| 久久免费偷拍视频| 亚洲精品在线电影| 亚洲美女淫视频| 偷拍亚洲欧洲综合| 男人的天堂久久精品| 国产在线观看免费一区| 成人午夜电影小说| 色视频一区二区| 欧美丰满少妇xxxbbb| 欧美电影免费观看完整版| 精品久久一区二区三区| ...xxx性欧美| 亚洲午夜久久久久中文字幕久| 日韩精品1区2区3区| 国产麻豆精品在线观看| av男人天堂一区| 欧美视频在线观看一区二区| 精品国产精品一区二区夜夜嗨| 国产精品无遮挡| 亚洲一区二区三区爽爽爽爽爽| 亚洲大型综合色站| 麻豆成人91精品二区三区| 国产69精品久久久久毛片| 欧美性大战久久久| 精品国产乱码久久久久久浪潮| 欧美视频精品在线观看| 91精品国产综合久久久蜜臀图片| 日韩一区二区在线免费观看| eeuss国产一区二区三区| 福利一区二区在线观看| 在线观看精品一区| 日韩一区二区免费在线电影 | 成人视屏免费看| 欧美性大战久久久久久久| 日韩亚洲欧美在线| 久久天堂av综合合色蜜桃网| 亚洲同性gay激情无套| 国产精品天美传媒| 亚洲在线中文字幕| 免费美女久久99| 91香蕉视频污| 精品国产精品网麻豆系列| 欧美成人伊人久久综合网| 欧美成人艳星乳罩| 亚洲与欧洲av电影| 精品无人码麻豆乱码1区2区 | 国产精品一品视频| 国产成人久久精品77777最新版本| 在线免费观看日韩欧美| 欧美精品一区二区三区久久久| 亚洲狠狠爱一区二区三区| 国产一区激情在线| 欧美一区二区二区| 18成人在线视频| 国产成人av电影在线观看| 91麻豆精品国产91久久久久| 国产精品视频观看| 国产精品123区| 日韩一级片网站| 亚洲一区二区三区精品在线| 91一区二区三区在线观看| 国产午夜精品久久久久久久| 久草这里只有精品视频| 欧美日韩精品欧美日韩精品一综合| 中文字幕在线播放不卡一区| 国产精品12区| 国产视频不卡一区| 国内国产精品久久| 91精品在线免费观看| 亚洲观看高清完整版在线观看 | 丝袜亚洲另类欧美| 97精品久久久久中文字幕 | 久久看人人爽人人| 国产福利91精品一区二区三区| 国产欧美日本一区视频| 日韩美女主播在线视频一区二区三区| 国产精品网站在线观看| 国产在线观看免费一区| 日韩免费一区二区| 强制捆绑调教一区二区| 91精品国产一区二区三区| 亚瑟在线精品视频| 在线免费不卡视频|