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

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

?? usbsample.c

?? linux device driver源碼
?? 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一区二区三区免费野_久草精品视频
综合久久久久综合| 日韩三区在线观看| 亚洲国产成人91porn| 91精品欧美综合在线观看最新| 日韩视频永久免费| 欧美日韩一区视频| 成人天堂资源www在线| 亚洲欧洲一区二区在线播放| 国产精品伊人色| 欧美电影免费观看高清完整版| 国产aⅴ综合色| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 国产精品天美传媒| 欧美最新大片在线看 | 欧美日韩中文一区| 处破女av一区二区| 91精品婷婷国产综合久久 | 精品捆绑美女sm三区| 色综合亚洲欧洲| 丰满少妇在线播放bd日韩电影| 日本不卡123| 亚洲综合色网站| 国产精品福利影院| 国产精品乱码一区二区三区软件 | 欧美巨大另类极品videosbest| www.欧美日韩| 99久久久久久| 99热国产精品| 色88888久久久久久影院野外| 岛国一区二区三区| 成+人+亚洲+综合天堂| aa级大片欧美| 91麻豆精品在线观看| 91麻豆精东视频| 91精品1区2区| 在线观看日韩精品| 欧美人妇做爰xxxⅹ性高电影| 在线观看av一区| 91精品国产91综合久久蜜臀| 国产精品一区二区三区99| 国产曰批免费观看久久久| 国产91在线观看| av成人动漫在线观看| 欧美私模裸体表演在线观看| 337p亚洲精品色噜噜噜| 精品国产乱码久久久久久免费| 国产色91在线| 丝袜亚洲精品中文字幕一区| 久久国产欧美日韩精品| 波多野洁衣一区| 67194成人在线观看| 久久久99精品免费观看| 麻豆成人综合网| 成人av电影免费在线播放| 91看片淫黄大片一级在线观看| 91精品国产91久久久久久一区二区 | 日本一区二区成人| 欧美日韩成人综合在线一区二区 | 91麻豆精品国产91久久久| 欧美午夜理伦三级在线观看| 在线视频一区二区三区| 日本一区二区高清| 亚洲精品高清视频在线观看| 国产午夜亚洲精品午夜鲁丝片| 亚洲综合色成人| 国产综合成人久久大片91| 精品中文字幕一区二区小辣椒| 麻豆精品视频在线观看免费| 在线看国产日韩| 国产女同性恋一区二区| 狂野欧美性猛交blacked| 欧洲一区二区三区在线| 国产精品欧美经典| 国产精品一区2区| 欧美大片国产精品| 麻豆成人久久精品二区三区小说| 91福利国产成人精品照片| 亚洲欧洲色图综合| 99免费精品视频| 中文字幕一区视频| 成人精品免费看| 国产精品久久久久久久久快鸭 | 国产精品一区二区在线播放| 国产精品一区二区男女羞羞无遮挡 | 欧美一级黄色大片| 奇米影视一区二区三区| 日韩无一区二区| 激情伊人五月天久久综合| 国产网红主播福利一区二区| 国产成人在线视频网址| 国产精品久久久久久久久免费相片 | 中文字幕av一区二区三区| 91麻豆自制传媒国产之光| 国产精品网友自拍| 成人av在线影院| 亚洲欧美激情插| 欧美人狂配大交3d怪物一区| 日本成人中文字幕在线视频| 久久伊人蜜桃av一区二区| 高清在线不卡av| 亚洲欧美日韩综合aⅴ视频| 日本韩国精品在线| 中文字幕亚洲一区二区va在线| 国产高清视频一区| 亚洲第一在线综合网站| 久久中文字幕电影| 欧美日韩国产一级片| 国产老妇另类xxxxx| 亚洲国产精品一区二区www| 日韩精品一区二区三区视频 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 粉嫩一区二区三区在线看| 丝袜诱惑制服诱惑色一区在线观看| 久久久久久久久伊人| 国产日韩欧美精品在线| 日韩影视精彩在线| 久久综合色8888| 欧美一区二区三区在线视频| 一本到三区不卡视频| 激情五月婷婷综合| 日产国产欧美视频一区精品| 亚洲精品成人悠悠色影视| 欧美国产日韩亚洲一区| 久久久精品日韩欧美| 精品国产髙清在线看国产毛片| 欧美色成人综合| 国产一区二区在线看| 亚洲欧洲精品天堂一级| 国产精品麻豆一区二区| 国产网红主播福利一区二区| 国产欧美一区二区精品性色超碰| 精品国产一区二区在线观看| 日韩欧美久久久| 精品88久久久久88久久久| 久久这里只有精品首页| 久久久精品免费免费| 国产婷婷色一区二区三区在线| 亚洲精品在线一区二区| 国产丝袜美腿一区二区三区| 国产欧美精品一区二区三区四区 | 日本一区二区三区国色天香 | 久久久久久久久久久久电影| 国产三级欧美三级| 国产精品电影一区二区三区| 国产高清精品网站| 亚洲精品中文字幕在线观看| 一区二区三区在线播| 日本不卡1234视频| 国产精品综合二区| 色综合久久99| 精品国产一区a| 亚洲免费观看高清| 激情综合色丁香一区二区| 99re在线视频这里只有精品| 7777精品伊人久久久大香线蕉超级流畅 | 成人午夜电影网站| 欧美日韩一区二区三区在线| 久久久久久久久蜜桃| 亚洲国产一二三| 成人午夜私人影院| 555www色欧美视频| 一区二区三区.www| 成人午夜激情片| 欧美成人一区二区| 石原莉奈在线亚洲三区| jiyouzz国产精品久久| 欧美顶级少妇做爰| 国产午夜精品久久久久久免费视| 国产精品视频观看| 狠狠网亚洲精品| 制服丝袜激情欧洲亚洲| 有坂深雪av一区二区精品| 国产99久久久国产精品免费看| 日韩一区二区视频在线观看| 亚洲第一会所有码转帖| 色呦呦日韩精品| 一区二区三区资源| 91国产视频在线观看| 亚洲精品视频免费观看| www.欧美.com| 亚洲人妖av一区二区| 不卡av在线免费观看| 国产日韩欧美综合在线| 成人在线一区二区三区| 国产欧美日本一区二区三区| 成人美女在线视频| 亚洲欧洲日韩av| 91同城在线观看| 亚洲影视在线播放| 欧美一区二区三区啪啪| 麻豆精品久久精品色综合| 精品久久久久99| 国产成人自拍在线| 亚洲午夜精品网| 欧美放荡的少妇| 成人av网址在线观看| 91精品国产综合久久蜜臀| 精品在线播放免费| 亚洲另类春色国产| 99视频国产精品|