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

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

?? input-programming.txt

?? Linux Kernel 2.6.9 for OMAP1710
?? TXT
字號:
$Id: input-programming.txt,v 1.4 2001/05/04 09:47:14 vojtech Exp $Programming input drivers~~~~~~~~~~~~~~~~~~~~~~~~~1. Creating an input device driver~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1.0 The simplest example~~~~~~~~~~~~~~~~~~~~~~~~Here comes a very simple example of an input device driver. The device hasjust one button and the button is accessible at i/o port BUTTON_PORT. Whenpressed or released a BUTTON_IRQ happens. The driver could look like:#include <linux/input.h>#include <linux/module.h>#include <linux/init.h>#include <asm/irq.h>#include <asm/io.h>static void button_interrupt(int irq, void *dummy, struct pt_regs *fp){	input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1);	input_sync(&button_dev);}static int __init button_init(void){	if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {                printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);                return -EBUSY;        }		button_dev.evbit[0] = BIT(EV_KEY);	button_dev.keybit[LONG(BTN_0)] = BIT(BTN_0);		input_register_device(&button_dev);}static void __exit button_exit(void){        input_unregister_device(&button_dev);	free_irq(BUTTON_IRQ, button_interrupt);}module_init(button_init);module_exit(button_exit);1.1 What the example does~~~~~~~~~~~~~~~~~~~~~~~~~First it has to include the <linux/input.h> file, which interfaces to theinput subsystem. This provides all the definitions needed.In the _init function, which is called either upon module load or whenbooting the kernel, it grabs the required resources (it should also checkfor the presence of the device).Then it sets the input bitfields. This way the device driver tells the otherparts of the input systems what it is - what events can be generated oraccepted by this input device. Our example device can only generate EV_KEY typeevents, and from those only BTN_0 event code. Thus we only set these twobits. We could have used	set_bit(EV_KEY, button_dev.evbit);	set_bit(BTN_0, button_dev.keybit);as well, but with more than single bits the first approach tends to beshorter. Then the example driver registers the input device structure by calling	input_register_device(&button_dev);This adds the button_dev structure to linked lists of the input driver andcalls device handler modules _connect functions to tell them a new inputdevice has appeared. Because the _connect functions may call kmalloc(,GFP_KERNEL), which can sleep, input_register_device() must not be calledfrom an interrupt or with a spinlock held.While in use, the only used function of the driver is	button_interrupt()which upon every interrupt from the button checks its state and reports itvia the 	input_report_key()call to the input system. There is no need to check whether the interruptroutine isn't reporting two same value events (press, press for example) tothe input system, because the input_report_* functions check thatthemselves.Then there is the	input_sync()call to tell those who receive the events that we've sent a complete report.This doesn't seem important in the one button case, but is quite importantfor for example mouse movement, where you don't want the X and Y valuesto be interpreted separately, because that'd result in a different movement.1.2 dev->open() and dev->close()~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In case the driver has to repeatedly poll the device, because it doesn'thave an interrupt coming from it and the polling is too expensive to be doneall the time, or if the device uses a valuable resource (eg. interrupt), itcan use the open and close callback to know when it can stop polling orrelease the interrupt and when it must resume polling or grab the interruptagain. To do that, we would add this to our example driver:int button_used = 0;static int button_open(struct input_dev *dev){        if (button_used++)                return 0;	if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {                printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);                button_used--;                return -EBUSY;        }        return 0;}static void button_close(struct input_dev *dev){        if (!--button_used)                free_irq(IRQ_AMIGA_VERTB, button_interrupt);}static int __init button_init(void){	...	button_dev.open = button_open;	button_dev.close = button_close;	...}Note the button_used variable - we have to track how many times the openfunction was called to know when exactly our device stops being used.The open() callback should return a 0 in case of success or any nonzero valuein case of failure. The close() callback (which is void) must always succeed.1.3 Basic event types~~~~~~~~~~~~~~~~~~~~~The most simple event type is EV_KEY, which is used for keys and buttons.It's reported to the input system via:	input_report_key(struct input_dev *dev, int code, int value)See linux/input.h for the allowable values of code (from 0 to KEY_MAX).Value is interpreted as a truth value, ie any nonzero value means keypressed, zero value means key released. The input code generates events onlyin case the value is different from before.In addition to EV_KEY, there are two more basic event types: EV_REL andEV_ABS. They are used for relative and absolute values supplied by thedevice. A relative value may be for example a mouse movement in the X axis.The mouse reports it as a relative difference from the last position,because it doesn't have any absolute coordinate system to work in. Absoluteevents are namely for joysticks and digitizers - devices that do work in anabsolute coordinate systems.Having the device report EV_REL buttons is as simple as with EV_KEY, simplyset the corresponding bits and call the	input_report_rel(struct input_dev *dev, int code, int value)function. Events are generated only for nonzero value. However EV_ABS requires a little special care. Before callinginput_register_device, you have to fill additional fields in the input_devstruct for each absolute axis your device has. If our button device had alsothe ABS_X axis:	button_dev.absmin[ABS_X] = 0;	button_dev.absmax[ABS_X] = 255;	button_dev.absfuzz[ABS_X] = 4;	button_dev.absflat[ABS_X] = 8;This setting would be appropriate for a joystick X axis, with the minimum of0, maximum of 255 (which the joystick *must* be able to reach, no problem ifit sometimes reports more, but it must be able to always reach the min andmax values), with noise in the data up to +- 4, and with a center flatposition of size 8.If you don't need absfuzz and absflat, you can set them to zero, which meanthat the thing is precise and always returns to exactly the center position(if it has any).1.4 The void *private field~~~~~~~~~~~~~~~~~~~~~~~~~~~This field in the input structure can be used to point to any private datastructures in the input device driver, in case the driver handles more thanone device. You'll need it in the open and close callbacks.1.5 NBITS(), LONG(), BIT()~~~~~~~~~~~~~~~~~~~~~~~~~~These three macros from input.h help some bitfield computations:	NBITS(x) - returns the length of a bitfield array in longs for x bits	LONG(x)  - returns the index in the array in longs for bit x	BIT(x)   - returns the index in a long for bit x1.6 The number, id* and name fields~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The dev->number is assigned by the input system to the input device when itis registered. It has no use except for identifying the device to the userin system messages.The dev->name should be set before registering the input device by the inputdevice driver. It's a string like 'Generic button device' containing auser friendly name of the device.The id* fields contain the bus ID (PCI, USB, ...), vendor ID and device IDof the device. The bus IDs are defined in input.h. The vendor and device idsare defined in pci_ids.h, usb_ids.h and similar include files. These fieldsshould be set by the input device driver before registering it.The idtype field can be used for specific information for the input devicedriver.The id and name fields can be passed to userland via the evdev interface.1.7 The keycode, keycodemax, keycodesize fields~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~These two fields will be used for any input devices that report their dataas scancodes. If not all scancodes can be known by autodetection, they mayneed to be set by userland utilities. The keycode array then is an arrayused to map from scancodes to input system keycodes. The keycode max willcontain the size of the array and keycodesize the size of each entry in it(in bytes).1.8 Key autorepeat~~~~~~~~~~~~~~~~~~... is simple. It is handled by the input.c module. Hardware autorepeat isnot used, because it's not present in many devices and even where it ispresent, it is broken sometimes (at keyboards: Toshiba notebooks). To enableautorepeat for your device, just set EV_REP in dev->evbit. All will behandled by the input system.1.9 Other event types, handling output events~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The other event types up to now are:EV_LED - used for the keyboard LEDs.EV_SND - used for keyboard beeps.They are very similar to for example key events, but they go in the otherdirection - from the system to the input device driver. If your input devicedriver can handle these events, it has to set the respective bits in evbit,*and* also the callback routine:	button_dev.event = button_event;int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);{	if (type == EV_SND && code == SND_BELL) {		outb(value, BUTTON_BELL);		return 0;	}	return -1;}This callback routine can be called from an interrupt or a BH (although thatisn't a rule), and thus must not sleep, and must not take too long to finish.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合久久久| 91视频免费看| 欧美刺激午夜性久久久久久久| 亚洲小说春色综合另类电影| 91在线观看免费视频| 一区二区三区在线免费观看| 一本色道久久加勒比精品| 亚洲午夜久久久久中文字幕久| 欧美日韩精品一区二区三区四区| 全部av―极品视觉盛宴亚洲| 26uuu亚洲综合色| 欧美一区二区三区四区久久| 日韩欧美另类在线| 欧美不卡一区二区| **欧美大码日韩| 亚洲一区影音先锋| 日本中文在线一区| 夜夜精品浪潮av一区二区三区| 欧美v亚洲v综合ⅴ国产v| 欧美tickle裸体挠脚心vk| 国产日韩精品视频一区| 一区二区高清在线| 久久精品国产第一区二区三区| 午夜国产不卡在线观看视频| 国产精品国产三级国产专播品爱网| 日韩午夜激情视频| 欧美一级免费大片| 国产免费久久精品| 国产综合成人久久大片91| 日韩在线卡一卡二| 亚洲欧美二区三区| 日韩午夜在线影院| 94-欧美-setu| 精彩视频一区二区| 精品一区二区三区av| 91麻豆国产在线观看| 精品理论电影在线观看| 亚洲一区二区三区视频在线| 国产精品白丝jk黑袜喷水| 777午夜精品视频在线播放| 亚洲小说春色综合另类电影| 国产一区二区三区精品视频| 精品日产卡一卡二卡麻豆| 亚洲婷婷国产精品电影人久久| 亚洲第四色夜色| 久久精品在线观看| 欧美久久久久免费| 97se亚洲国产综合在线| 激情综合色综合久久综合| 一区二区三区四区av| 欧美国产成人在线| 欧美成人一区二区| 欧美年轻男男videosbes| 99视频一区二区| 国产91精品在线观看| 激情五月婷婷综合网| 三级欧美韩日大片在线看| 亚洲素人一区二区| 国产精品免费久久| 国产视频一区二区在线观看| 91精品国产麻豆| 欧美日韩一级黄| 91麻豆免费观看| 不卡欧美aaaaa| 成人美女视频在线观看18| 精品亚洲国产成人av制服丝袜 | 91在线免费看| 国产乱一区二区| 国内外成人在线| 久久精品久久精品| 久久99精品网久久| 韩国视频一区二区| 久久99久久精品| 国产在线观看一区二区| 国产一区二区三区蝌蚪| 国产馆精品极品| 国产成人精品一区二区三区四区 | 国产一区二区三区在线观看免费| 蜜桃传媒麻豆第一区在线观看| 五月婷婷激情综合| 日韩成人午夜精品| 日韩电影在线一区二区三区| 日韩国产精品久久| 久久电影网电视剧免费观看| 麻豆成人久久精品二区三区红| 日韩不卡免费视频| 久久精品国产在热久久| 国产精品系列在线观看| 一本色道亚洲精品aⅴ| 色婷婷精品久久二区二区蜜臂av | 亚洲欧美另类小说| 亚洲一区二区三区在线| 香蕉久久一区二区不卡无毒影院| 图片区小说区区亚洲影院| 免费日本视频一区| 精品写真视频在线观看| 粉嫩aⅴ一区二区三区四区五区| 粉嫩蜜臀av国产精品网站| 色综合天天性综合| 欧美美女一区二区在线观看| 日韩免费高清av| 欧美精彩视频一区二区三区| 亚洲欧洲综合另类在线| 首页国产欧美日韩丝袜| 国产精品亚洲一区二区三区妖精 | 一本久久a久久免费精品不卡| 欧美日韩小视频| 久久人人爽爽爽人久久久| 国产精品传媒视频| 日本伊人午夜精品| 成人av资源网站| 7777精品伊人久久久大香线蕉的 | 国产精品美日韩| 亚洲18色成人| 粉嫩13p一区二区三区| 欧美性猛交xxxx乱大交退制版| 欧美大胆一级视频| 亚洲免费资源在线播放| 蜜桃在线一区二区三区| 91在线观看免费视频| 日韩欧美国产一二三区| 亚洲欧洲日韩女同| 美女视频免费一区| 91极品视觉盛宴| 精品99999| 午夜婷婷国产麻豆精品| 国产99一区视频免费| 欧美军同video69gay| 中文字幕在线播放不卡一区| 麻豆久久一区二区| 欧美系列一区二区| 国产精品私房写真福利视频| 奇米影视一区二区三区| 在线观看av一区| 欧美韩国日本不卡| 成人免费毛片高清视频| 欧美猛男男办公室激情| 亚洲人成网站色在线观看| 国产综合色在线| 日韩一区二区三区免费看| 亚洲一区二区五区| 91在线免费看| 欧美激情一区不卡| 国产九色sp调教91| 日韩小视频在线观看专区| 亚洲成人第一页| 91福利区一区二区三区| 国产精品女人毛片| 国产福利91精品一区二区三区| 3d动漫精品啪啪| 香蕉av福利精品导航| 在线日韩av片| 亚洲日本青草视频在线怡红院| 国产a精品视频| 国产欧美日韩麻豆91| 国产在线精品一区在线观看麻豆| 在线播放91灌醉迷j高跟美女| 亚洲最大成人网4388xx| 色综合久久中文字幕| 亚洲欧美日韩国产另类专区 | 一区二区三区波多野结衣在线观看| 成人黄色电影在线| 国产精品久久久久久久久动漫 | 亚洲制服丝袜在线| 91久久精品日日躁夜夜躁欧美| 亚洲人成在线观看一区二区| 成人听书哪个软件好| 国产精品久久久99| 91亚洲精品久久久蜜桃| 日韩一区中文字幕| 在线视频亚洲一区| 亚洲v中文字幕| 日韩一区二区在线观看视频| 久久精品国产澳门| 国产丝袜美腿一区二区三区| 粉嫩蜜臀av国产精品网站| 国产日韩欧美高清在线| av资源网一区| 一区二区在线观看视频| 欧美男男青年gay1069videost| 天堂午夜影视日韩欧美一区二区| 9191国产精品| 国内外成人在线| 国产精品久久久久久亚洲毛片| 色噜噜夜夜夜综合网| 亚洲在线成人精品| 日韩欧美国产成人一区二区| 国产在线日韩欧美| 国产精品久久久久久久午夜片| 色拍拍在线精品视频8848| 日本中文在线一区| 国产日产欧美一区| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲国产精品久久久久秋霞影院 | 欧美日韩国产美女| 精品在线一区二区三区| 欧美激情艳妇裸体舞| 欧美少妇xxx| 捆绑调教美女网站视频一区| 欧美激情一区二区三区不卡 |