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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? usbsample.c

?? Linux設(shè)備驅(qū)動(dòng)程序第二版
?? C
字號(hào):
/* * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates * * The source code in this file can be freely used, adapted, * and redistributed in source or binary form, so long as an * acknowledgment appears in derived source files.  The citation * should list that the code comes from the book "Linux Device * Drivers" by Alessandro Rubini and Jonathan Corbet, published * by O'Reilly & Associates.   No warranty is attached; * we cannot take responsibility for errors or fitness for use. * * * This sample driver implements USB protocol decoding for both an USB * keyboard and an USB mouse. You can test it using either device, provided * they are not already managed by the official drivers. If you want * to only experiment with one device, pass the nokbd=1 or the * no_mouse=1 option to the command line of insmod */#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#include <linux/config.h>#include <linux/module.h>/* No USB with 2.0, make an explicit error and avoid strange ones */#if LINUX_VERSION_CODE < 0x020200#  error "This module needs kmod, so it won't run with 2.0"#else#include <linux/kernel.h>#include <linux/malloc.h>#include <linux/init.h>#include <linux/usb.h>/* * Note: <linux/usb.h> in 2.2 includes <linux/kcomp.h> that breaks * our sysdep.h . You can't disable kcomp.h from entering the game, * so "sysdep.h" can't be included here. If you write a backward-portable * driver with both USB and something-else support, you need to separate * the USB stuff in order not to rely on sysdep.h in USB-related  files */#if 0  #include "sysdep.h"#else  #include "usb-sysdep.h"#endif/* * We need a local data structure, as it must be allocated for each new * mouse device plugged in the USB bus */struct sample_device {    unsigned char data[8];   /* enough for keyboard and mouse protocols */    char *name;              /* either "kdb" or "mouse" */    struct urb urb;          /* USB Request block, to get USB data*/    int maxp;                /* packet len */    char output[80];         /* used for printk at irq time */};/* * Handler for data sent in by the device. The function is called by * the USB kernel subsystem whenever a device spits out new data */static void sample_irq(struct urb *urb){    struct sample_device *sample = urb->context;    char *pos = sample->output;    int i;    if (urb->status != USB_ST_NOERROR) return;    pos += sprintf(pos, "usbsample: data from %-8s =",		   sample->name);    for (i=0; i<sample->maxp; i++) {	pos += sprintf(pos, " %02x", sample->data[i]);    }    printk(KERN_INFO "%s\n", sample->output);}/* * These two callbacks are invoked when an USB device is detached or attached * to the bus */static void sample_disconnect(struct usb_device *udev, void *clientdata){    /* the clientdata is the sample_device we passed originally */    struct sample_device *sample = clientdata;    /* remove the URB, remove the input device, free memory */    usb_unlink_urb(&sample->urb);    kfree(sample);    printk(KERN_INFO "sample: USB %s disconnected\n", sample->name);    /*     * here you might MOD_DEC_USE_COUNT, but only if you increment     * the count in sample_probe() below     */    return;}static void *sample_probe(struct usb_device *udev, unsigned int ifnum,			  const struct usb_device_id *id){    /*     * The probe procedure is pretty standard. Device matching has already     * been performed based on the id_table structure (defined later)     */    struct usb_interface *iface;    struct usb_interface_descriptor *interface;    struct usb_endpoint_descriptor *endpoint;    struct sample_device *sample;    printk(KERN_INFO "usbsample: probe called for %s device\n",	   (char *)id->driver_info /* "mouse" or "keyboard" */ );    iface = &udev->actconfig->interface[ifnum];    interface = &iface->altsetting[iface->act_altsetting];    if (interface->bNumEndpoints != 1) return NULL;    endpoint = interface->endpoint + 0;    if (!(endpoint->bEndpointAddress & 0x80)) return NULL;    if ((endpoint->bmAttributes & 3) != 3) return NULL;    usb_set_protocol(udev, interface->bInterfaceNumber, 0);    usb_set_idle(udev, interface->bInterfaceNumber, 0, 0);    /* allocate and zero a new data structure for the new device */    sample = kmalloc(sizeof(struct sample_device), GFP_KERNEL);    if (!sample) return NULL; /* failure */    memset(sample, 0, sizeof(*sample));    sample->name = (char *)id->driver_info;    /* fill the URB data structure using the FILL_INT_URB macro */    {	int pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);	int maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));		if (maxp > 8) maxp = 8; sample->maxp = maxp; /* remember for later */	FILL_INT_URB(&sample->urb, udev, pipe, sample->data, maxp,		      sample_irq, sample, endpoint->bInterval);    }    /* register the URB within the USB subsystem */    if (usb_submit_urb(&sample->urb)) {	kfree(sample);	return NULL;    }    /* announce yourself */    printk(KERN_INFO "usbsample: probe successful for %s (maxp is %i)\n",	   sample->name, sample->maxp);    /*     * here you might MOD_INC_USE_COUNT; if you do, you'll need to unplug     * the device or the devices before being able to unload the module     */    /* and return the new structure */    return sample;}/* * The id_table, lists all devices that can be handled by this driver. * The three numbers are class, subclass, protocol. <linux/usb.h> has * more details about interface mathces and vendor/device matches. * This feature is not there in version 2.2, see below, sample_probe_22() * for details. Here we use a fake usb_device_id structure defined in  * ./usb-sysdep.h */static struct usb_device_id sample_id_table [] = {    {	USB_INTERFACE_INFO(3, 1, 1),	driver_info: (unsigned long)"keyboard"    },    {	USB_INTERFACE_INFO(3, 1, 2),	driver_info: (unsigned long)"mouse"    },    {	0, /* no more matches */    }};/* * The callbacks are registered within the USB subsystem using the * usb_driver data structure */#ifdef LINUX_24static struct usb_driver sample_usb_driver = {        name:        "sample",        probe:       sample_probe,        disconnect:  sample_disconnect,        id_table:    sample_id_table,};#else /* 2.2 *//* * With version 2.2, there is no device_id support: the probe function * is called for every device being plugged, and it must select whether * the device is going to be handled or not. Here we extract the identification * phase (based on class/subclass/protocol in this case) and rely on * sample_probe() above for the interesting part of the game. Note * that a 2.4 driver can use this approach as well, by not defining an * id table (and achieving a 2.2 and 2.4 source with less ifdef). We think * the id_table way is much cleaner, so we chose to exploit it where available */static void *sample_probe_22(struct usb_device *udev, unsigned int ifnum){    struct usb_device_id *id;    struct usb_interface_descriptor *interface;    printk(KERN_INFO "sample_probe_22 called\n");    if (udev->descriptor.bNumConfigurations != 1) return NULL;    interface = udev->config[0].interface[ifnum].altsetting;    for (id = sample_id_table; id->driver_info; id++) {        if (interface->bInterfaceClass !=    id->class)    continue;        if (interface->bInterfaceSubClass != id->subclass) continue;        if (interface->bInterfaceProtocol != id->protocol) continue;	break; /* found */    }    if (!id->driver_info)	return NULL; /* not ours */    return sample_probe(udev, ifnum, id);}static struct usb_driver sample_usb_driver = {        name:        "sample",        probe:       sample_probe_22,        disconnect:  sample_disconnect,	/* no id_table field here */};#endif /* 2.2 *//* * Functions called at module load and unload time: only register and * unregister the USB callbacks */int sample_init(void){    /* just register it, returns 0 or error code */    return usb_register(&sample_usb_driver);}void sample_exit(void){    usb_deregister(&sample_usb_driver);}module_init(sample_init);module_exit(sample_exit);#endif /* no 2.0 */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩美一区二区三区| 国产一区二区美女诱惑| 91玉足脚交白嫩脚丫在线播放| 2020国产精品久久精品美国| 激情五月激情综合网| 国产清纯白嫩初高生在线观看91 | 国产91精品露脸国语对白| 欧美成人性福生活免费看| 久久成人免费电影| 日本一区二区三区在线不卡| eeuss鲁片一区二区三区在线看| 亚洲乱码国产乱码精品精可以看| 日本韩国欧美一区二区三区| 日韩精品一级二级| 久久久91精品国产一区二区三区| 国产91丝袜在线观看| 一区二区三区在线视频播放| 在线播放91灌醉迷j高跟美女| 偷拍亚洲欧洲综合| 久久精品日产第一区二区三区高清版 | 538prom精品视频线放| 美女国产一区二区三区| 国产欧美1区2区3区| 在线亚洲高清视频| 精品一二三四区| 亚洲欧美综合色| 日韩一级片网址| 国产一区二区导航在线播放| 亚洲精品成人a在线观看| 欧美一区二区三区四区五区| 粉嫩aⅴ一区二区三区四区五区| 亚洲乱码国产乱码精品精的特点 | 六月丁香婷婷久久| 亚洲视频网在线直播| 日韩欧美国产成人一区二区| 99国产精品久| 久久精品国产澳门| 亚洲最大的成人av| 国产欧美日本一区二区三区| 欧美在线制服丝袜| 国产91丝袜在线播放九色| 日韩国产精品久久久久久亚洲| 久久久精品欧美丰满| 欧美日韩mp4| 91女厕偷拍女厕偷拍高清| 精品在线一区二区三区| 亚洲国产wwwccc36天堂| 国产精品国产三级国产专播品爱网 | 国产精品一区二区果冻传媒| 午夜视频久久久久久| 亚洲日本乱码在线观看| 国产欧美综合在线| 日韩色视频在线观看| 欧美亚洲综合色| 国产99精品视频| 狠狠色伊人亚洲综合成人| 视频一区二区三区在线| 亚洲男人的天堂网| 国产精品电影院| 国产日韩欧美麻豆| 亚洲精品一区二区三区四区高清| 欧美日韩国产另类一区| 91精品91久久久中77777| 成人99免费视频| 久久超碰97中文字幕| 日韩在线一二三区| 日韩高清一区在线| 亚洲第一av色| 亚洲国产精品一区二区尤物区| 成人免费视频在线观看| 国产精品麻豆一区二区| 国产精品私人影院| 日本在线不卡视频| 日韩和欧美的一区| 天堂在线亚洲视频| 日一区二区三区| 视频一区二区欧美| 蜜臀av性久久久久蜜臀aⅴ流畅 | 99久久久国产精品| 成人av在线电影| kk眼镜猥琐国模调教系列一区二区| 高清成人免费视频| 波多野结衣在线一区| aaa国产一区| 色天使色偷偷av一区二区| 色国产综合视频| 欧美高清视频一二三区| 欧美一区二视频| 久久综合丝袜日本网| 久久久一区二区三区| 国产精品久久久99| 亚洲一区二区三区四区五区黄| 午夜视频久久久久久| 久久国产精品99久久久久久老狼| 国内一区二区在线| 懂色av一区二区夜夜嗨| 91麻豆国产精品久久| 欧美图片一区二区三区| 日韩久久久精品| 国产精品欧美经典| 亚洲影视在线观看| 久久99精品久久久久久动态图| 国产剧情在线观看一区二区| 波多野结衣中文字幕一区| 欧美亚洲另类激情小说| 日韩欧美的一区| 国产精品免费视频网站| 亚洲一线二线三线久久久| 日本91福利区| 成人性生交大片免费看中文| 欧美在线免费观看亚洲| 日韩美女视频在线| 1区2区3区精品视频| 午夜精品免费在线观看| 国产成人午夜视频| 欧美三级日韩三级国产三级| www久久精品| 亚洲激情图片小说视频| 久久国产免费看| 在线亚洲精品福利网址导航| 欧美精品一区二区三区四区| 伊人婷婷欧美激情| 国产高清久久久| 欧美日本精品一区二区三区| 国产清纯在线一区二区www| 丝袜亚洲另类丝袜在线| www.在线欧美| 精品福利在线导航| 亚洲高清一区二区三区| 高清久久久久久| 日韩三级视频在线看| 综合婷婷亚洲小说| 国产河南妇女毛片精品久久久| 欧美视频中文一区二区三区在线观看| 26uuu另类欧美| 婷婷综合五月天| 91丝袜国产在线播放| 精品粉嫩超白一线天av| 亚洲午夜在线视频| av成人免费在线| 久久亚洲欧美国产精品乐播| 性久久久久久久| 91国偷自产一区二区使用方法| 国产欧美一区二区在线| 另类调教123区| 欧美精品久久99久久在免费线| 亚洲欧美日韩国产手机在线 | 国产喷白浆一区二区三区| 日韩中文字幕亚洲一区二区va在线| 99久久精品国产一区二区三区| 久久影院视频免费| 久久99精品国产麻豆婷婷洗澡| 精品视频在线免费观看| 亚洲日本免费电影| 99久久精品国产网站| 国产精品成人在线观看| 国产99一区视频免费| 国产亚洲欧美一级| 国产精品自拍网站| 久久蜜桃av一区二区天堂 | 国产一区二区久久| 欧美大片免费久久精品三p| 免费在线观看精品| 日韩一区二区在线观看视频播放| 午夜免费久久看| 欧美日韩不卡一区二区| 日本一区中文字幕| 91精品福利在线一区二区三区| 石原莉奈一区二区三区在线观看| 精品视频在线视频| 日韩国产欧美在线视频| 欧美日产在线观看| 美腿丝袜亚洲一区| 精品久久久久久久久久久院品网| 麻豆成人免费电影| 久久影院电视剧免费观看| 国产精品一区二区在线观看不卡 | 欧美日韩中字一区| 午夜精品国产更新| 91精品国产综合久久久久久漫画 | 亚洲免费av高清| 色狠狠av一区二区三区| 亚洲国产日韩a在线播放性色| 欧美精品在线视频| 精品中文字幕一区二区| 国产欧美在线观看一区| 一本久久精品一区二区| 亚洲成人精品一区二区| 日韩午夜在线播放| 国产精品18久久久久久久网站| 国产精品乱子久久久久| 色婷婷综合久久久久中文| 午夜视频一区二区| 精品成a人在线观看| 99麻豆久久久国产精品免费| 亚洲国产一二三| 久久综合久久鬼色中文字| 97精品久久久午夜一区二区三区 | www.爱久久.com| 亚洲国产成人va在线观看天堂 |