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

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

?? usbsample.c

?? 基于linux2.4內(nèi)核的USB驅(qū)動程序
?? C
字號:
/* * 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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产婷婷色一区二区三区四区 | 欧美三级中文字幕| 久久久www免费人成精品| 欧美96一区二区免费视频| 欧美日韩精品久久久| 一个色综合av| 色偷偷久久一区二区三区| 最新不卡av在线| 99精品欧美一区二区三区综合在线| 欧美国产欧美综合| 国产91精品一区二区麻豆网站| 久久女同互慰一区二区三区| 国产一区二区美女诱惑| 久久久久久久久99精品| 国产乱人伦偷精品视频不卡| xnxx国产精品| 国产精品一区二区三区网站| 久久尤物电影视频在线观看| 国产中文字幕精品| 久久精品一区二区三区不卡| 狠狠色丁香九九婷婷综合五月| 亚洲精品一区二区精华| 国产精华液一区二区三区| 久久久久久**毛片大全| 成人在线视频一区| 国产精品动漫网站| 91蜜桃在线观看| 一区二区三区.www| 欧美日韩小视频| 免费欧美在线视频| 精品国产自在久精品国产| 国产一区二区电影| 中文字幕va一区二区三区| 国产福利精品一区| 18涩涩午夜精品.www| 国产成人夜色高潮福利影视| 欧美国产精品v| 91亚洲国产成人精品一区二区三| 亚洲人午夜精品天堂一二香蕉| 国产一区二区电影| 国产精品久久久久久户外露出 | 韩国av一区二区三区四区 | 在线播放国产精品二区一二区四区| 亚洲一区视频在线| 日韩欧美一区二区视频| 麻豆成人免费电影| 亚洲国产精品精华液2区45| 高清成人免费视频| 国产精品婷婷午夜在线观看| 91污片在线观看| 亚洲综合在线第一页| 日韩欧美一级在线播放| 精品亚洲porn| 自拍视频在线观看一区二区| 色婷婷精品久久二区二区蜜臀av| 无吗不卡中文字幕| 欧美一区二区三区四区久久| 韩国欧美一区二区| 中文字幕一区二区三区蜜月 | 国产成人超碰人人澡人人澡| 亚洲精品免费电影| 欧美男生操女生| 麻豆精品一区二区| 国产日韩欧美精品电影三级在线 | 懂色中文一区二区在线播放| 亚洲图片激情小说| 777奇米四色成人影色区| 国产精品亚洲а∨天堂免在线| 亚洲欧洲日韩一区二区三区| 69精品人人人人| 黄页视频在线91| 一区二区三区在线观看国产| 91麻豆精品国产91久久久久| 成人91在线观看| 亚洲v精品v日韩v欧美v专区| 欧美激情一区不卡| 在线观看三级视频欧美| 国产乱对白刺激视频不卡| 亚洲婷婷综合色高清在线| 欧美三区在线观看| 国产精品一品视频| 亚洲日本成人在线观看| 欧美成人精品高清在线播放| www.欧美.com| 日韩av网站免费在线| 久久久久久毛片| 在线观看日韩高清av| 国产成人精品免费视频网站| 午夜伦欧美伦电影理论片| 日韩视频一区二区| 色哟哟精品一区| 国产一区二区精品久久99| 亚洲国产日产av| 2欧美一区二区三区在线观看视频| 色综合天天在线| 蜜臂av日日欢夜夜爽一区| 亚洲一二三四久久| 久久久99久久| 欧美成人r级一区二区三区| av在线播放不卡| 国产乱子轮精品视频| 亚洲国产美女搞黄色| 亚洲天堂2014| 久久看人人爽人人| 日韩欧美123| 欧美专区亚洲专区| 95精品视频在线| 黄色小说综合网站| 麻豆精品久久精品色综合| 亚洲精品中文在线观看| 国产精品久久久久桃色tv| 日韩欧美国产一区二区三区| 欧美日韩高清一区| av电影在线观看不卡| 国产成人一区二区精品非洲| 青青草国产精品亚洲专区无| 亚洲国产视频a| 综合中文字幕亚洲| 国产精品久久久久久久久免费桃花| 欧美一区二区久久| 欧美电影一区二区| 一本色道久久综合狠狠躁的推荐| 风流少妇一区二区| 韩国一区二区视频| 国产一区二区日韩精品| 午夜久久久影院| 天天色综合天天| 亚洲综合网站在线观看| 亚洲精品免费视频| 自拍偷拍国产精品| 亚洲精品国产视频| 国产精品久久久久久久久快鸭| 国产精品国产三级国产专播品爱网 | 国产盗摄视频一区二区三区| 麻豆专区一区二区三区四区五区| 麻豆国产一区二区| 三级在线观看一区二区| 天天色 色综合| 亚洲第一福利视频在线| 亚洲高清中文字幕| 亚洲永久免费视频| 午夜伦理一区二区| 亚洲地区一二三色| 日韩高清在线电影| 五月天一区二区| 午夜视黄欧洲亚洲| 视频在线在亚洲| 久久精品国产精品亚洲综合| 蜜臀av性久久久久蜜臀av麻豆| 美女mm1313爽爽久久久蜜臀| 免费观看久久久4p| 韩国三级在线一区| 日韩福利电影在线观看| 久久99精品一区二区三区| 日韩**一区毛片| 秋霞电影一区二区| 免费高清成人在线| 亚洲午夜精品在线| 午夜精品久久久久久久蜜桃app| 免费成人av资源网| 久久精品国产99国产精品| 国产伦精品一区二区三区免费迷 | 久久精品国产99国产| 精品无人码麻豆乱码1区2区| 激情小说亚洲一区| 国产v日产∨综合v精品视频| 成人做爰69片免费看网站| 丰满少妇在线播放bd日韩电影| 国产凹凸在线观看一区二区| 激情欧美一区二区三区在线观看| 国产一区美女在线| 国产成人午夜片在线观看高清观看| 国产成a人无v码亚洲福利| 粉嫩aⅴ一区二区三区四区 | 麻豆国产精品官网| 国产高清精品久久久久| 99久久er热在这里只有精品15 | 大陆成人av片| 欧美色图激情小说| 欧美一级黄色大片| 国产欧美日韩视频一区二区| 日本一区二区成人在线| 午夜久久久影院| 狠狠狠色丁香婷婷综合激情 | 粉嫩一区二区三区性色av| 99精品视频中文字幕| 欧美精品色综合| 2020国产精品| 亚洲免费大片在线观看| 亚洲摸摸操操av| 久久电影网站中文字幕| 久久99精品国产.久久久久 | 亚洲毛片av在线| 三级成人在线视频| 国产精一区二区三区| 欧美午夜宅男影院| 欧美一级精品在线| 亚洲精品大片www| 韩国成人精品a∨在线观看| 色婷婷综合中文久久一本|