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

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

?? rio500.c

?? linux和2410結合開發 用他可以生成2410所需的zImage文件
?? C
字號:
/* -*- linux-c -*- *//*  * Driver for USB Rio 500 * * Cesar Miquel (miquel@df.uba.ar) *  * based on hp_scanner.c by David E. Nelson (dnelson@jump.net) *  * 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. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Based upon mouse.c (Brad Keryan) and printer.c (Michael Gee). * * */#include <linux/module.h>#include <linux/kernel.h>#include <linux/signal.h>#include <linux/sched.h>#include <linux/errno.h>#include <linux/miscdevice.h>#include <linux/random.h>#include <linux/poll.h>#include <linux/init.h>#include <linux/slab.h>#include <linux/spinlock.h>#include <linux/usb.h>#include <linux/smp_lock.h>#include <linux/devfs_fs_kernel.h>#include "rio500_usb.h"/* * Version Information */#define DRIVER_VERSION "v1.1"#define DRIVER_AUTHOR "Cesar Miquel <miquel@df.uba.ar>"#define DRIVER_DESC "USB Rio 500 driver"#define RIO_MINOR   64/* stall/wait timeout for rio */#define NAK_TIMEOUT (HZ)#define IBUF_SIZE 0x1000/* Size of the rio buffer */#define OBUF_SIZE 0x10000struct rio_usb_data {        struct usb_device *rio_dev;     /* init: probe_rio */        devfs_handle_t devfs;           /* devfs device */        unsigned int ifnum;             /* Interface number of the USB device */        int isopen;                     /* nz if open */        int present;                    /* Device is present on the bus */        char *obuf, *ibuf;              /* transfer buffers */        char bulk_in_ep, bulk_out_ep;   /* Endpoint assignments */        wait_queue_head_t wait_q;       /* for timeouts */	struct semaphore lock;          /* general race avoidance */};extern devfs_handle_t usb_devfs_handle;	/* /dev/usb dir. */static struct rio_usb_data rio_instance;static int open_rio(struct inode *inode, struct file *file){	struct rio_usb_data *rio = &rio_instance;	lock_kernel();	if (rio->isopen || !rio->present) {		unlock_kernel();		return -EBUSY;	}	rio->isopen = 1;	init_waitqueue_head(&rio->wait_q);	MOD_INC_USE_COUNT;	unlock_kernel();	info("Rio opened.");	return 0;}static int close_rio(struct inode *inode, struct file *file){	struct rio_usb_data *rio = &rio_instance;	rio->isopen = 0;	MOD_DEC_USE_COUNT;	info("Rio closed.");	return 0;}static intioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,	  unsigned long arg){	struct RioCommand rio_cmd;	struct rio_usb_data *rio = &rio_instance;	void *data;	unsigned char *buffer;	int result, requesttype;	int retries;	int retval=0;	down(&(rio->lock));        /* Sanity check to make sure rio is connected, powered, etc */        if ( rio == NULL ||             rio->present == 0 ||             rio->rio_dev == NULL )	{		retval = -ENODEV;		goto err_out;	}	switch (cmd) {	case RIO_RECV_COMMAND:		data = (void *) arg;		if (data == NULL)			break;		if (copy_from_user(&rio_cmd, data, sizeof(struct RioCommand))) {			retval = -EFAULT;			goto err_out;		}		if (rio_cmd.length > PAGE_SIZE) {			retval = -EINVAL;			goto err_out;		}		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);		if (buffer == NULL) {			retval = -ENOMEM;			goto err_out;		}		if (copy_from_user(buffer, rio_cmd.buffer, rio_cmd.length)) {			retval = -EFAULT;			free_page((unsigned long) buffer);			goto err_out;		}		requesttype = rio_cmd.requesttype | USB_DIR_IN |		    USB_TYPE_VENDOR | USB_RECIP_DEVICE;		dbg		    ("sending command:reqtype=%0x req=%0x value=%0x index=%0x len=%0x",		     requesttype, rio_cmd.request, rio_cmd.value,		     rio_cmd.index, rio_cmd.length);		/* Send rio control message */		retries = 3;		while (retries) {			result = usb_control_msg(rio->rio_dev,						 usb_rcvctrlpipe(rio-> rio_dev, 0),						 rio_cmd.request,						 requesttype,						 rio_cmd.value,						 rio_cmd.index, buffer,						 rio_cmd.length,						 rio_cmd.timeout);			if (result == -ETIMEDOUT)				retries--;			else if (result < 0) {				err("Error executing ioctrl. code = %d",				     le32_to_cpu(result));				retries = 0;			} else {				dbg("Executed ioctl. Result = %d (data=%04x)",				     le32_to_cpu(result),				     le32_to_cpu(*((long *) buffer)));				if (copy_to_user(rio_cmd.buffer, buffer,						 rio_cmd.length)) {					free_page((unsigned long) buffer);					retval = -EFAULT;					goto err_out;				}				retries = 0;			}			/* rio_cmd.buffer contains a raw stream of single byte			   data which has been returned from rio.  Data is			   interpreted at application level.  For data that			   will be cast to data types longer than 1 byte, data			   will be little_endian and will potentially need to			   be swapped at the app level */		}		free_page((unsigned long) buffer);		break;	case RIO_SEND_COMMAND:		data = (void *) arg;		if (data == NULL)			break;		if (copy_from_user(&rio_cmd, data, sizeof(struct RioCommand))) {			retval = -EFAULT;			goto err_out;		}		if (rio_cmd.length > PAGE_SIZE) {			retval = -EINVAL;			goto err_out;		}		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);		if (buffer == NULL) {			retval = -ENOMEM;			goto err_out;		}		if (copy_from_user(buffer, rio_cmd.buffer, rio_cmd.length)) {			free_page((unsigned long)buffer);			retval = -EFAULT;			goto err_out;		}		requesttype = rio_cmd.requesttype | USB_DIR_OUT |		    USB_TYPE_VENDOR | USB_RECIP_DEVICE;		dbg("sending command: reqtype=%0x req=%0x value=%0x index=%0x len=%0x",		     requesttype, rio_cmd.request, rio_cmd.value,		     rio_cmd.index, rio_cmd.length);		/* Send rio control message */		retries = 3;		while (retries) {			result = usb_control_msg(rio->rio_dev,						 usb_sndctrlpipe(rio-> rio_dev, 0),						 rio_cmd.request,						 requesttype,						 rio_cmd.value,						 rio_cmd.index, buffer,						 rio_cmd.length,						 rio_cmd.timeout);			if (result == -ETIMEDOUT)				retries--;			else if (result < 0) {				err("Error executing ioctrl. code = %d",				     le32_to_cpu(result));				retries = 0;			} else {				dbg("Executed ioctl. Result = %d",				       le32_to_cpu(result));				retries = 0;			}		}		free_page((unsigned long) buffer);		break;	default:		retval = -ENOTTY;		break;	}err_out:	up(&(rio->lock));	return retval;}static ssize_twrite_rio(struct file *file, const char *buffer,	  size_t count, loff_t * ppos){	struct rio_usb_data *rio = &rio_instance;	unsigned long copy_size;	unsigned long bytes_written = 0;	unsigned int partial;	int result = 0;	int maxretry;	int errn = 0;	down(&(rio->lock));        /* Sanity check to make sure rio is connected, powered, etc */        if ( rio == NULL ||             rio->present == 0 ||             rio->rio_dev == NULL )	{		up(&(rio->lock));		return -ENODEV;	}	do {		unsigned long thistime;		char *obuf = rio->obuf;		thistime = copy_size =		    (count >= OBUF_SIZE) ? OBUF_SIZE : count;		if (copy_from_user(rio->obuf, buffer, copy_size)) {			errn = -EFAULT;			goto error;		}		maxretry = 5;		while (thistime) {			if (!rio->rio_dev) {				errn = -ENODEV;				goto error;			}			if (signal_pending(current)) {				up(&(rio->lock));				return bytes_written ? bytes_written : -EINTR;			}			result = usb_bulk_msg(rio->rio_dev,					 usb_sndbulkpipe(rio->rio_dev, 2),					 obuf, thistime, &partial, 5 * HZ);			dbg("write stats: result:%d thistime:%lu partial:%u",			     result, thistime, partial);			if (result == USB_ST_TIMEOUT) {	/* NAK - so hold for a while */				if (!maxretry--) {					errn = -ETIME;					goto error;				}				interruptible_sleep_on_timeout(&rio-> wait_q, NAK_TIMEOUT);				continue;			} else if (!result & partial) {				obuf += partial;				thistime -= partial;			} else				break;		};		if (result) {			err("Write Whoops - %x", result);			errn = -EIO;			goto error;		}		bytes_written += copy_size;		count -= copy_size;		buffer += copy_size;	} while (count > 0);	up(&(rio->lock));	return bytes_written ? bytes_written : -EIO;error:	up(&(rio->lock));	return errn;}static ssize_tread_rio(struct file *file, char *buffer, size_t count, loff_t * ppos){	struct rio_usb_data *rio = &rio_instance;	ssize_t read_count;	unsigned int partial;	int this_read;	int result;	int maxretry = 10;	char *ibuf;	down(&(rio->lock));	/* Sanity check to make sure rio is connected, powered, etc */        if ( rio == NULL ||             rio->present == 0 ||             rio->rio_dev == NULL )	{		up(&(rio->lock));		return -ENODEV;	}	ibuf = rio->ibuf;	read_count = 0;	while (count > 0) {		if (signal_pending(current)) {			up(&(rio->lock));			return read_count ? read_count : -EINTR;		}		if (!rio->rio_dev) {			up(&(rio->lock));			return -ENODEV;		}		this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count;		result = usb_bulk_msg(rio->rio_dev,				      usb_rcvbulkpipe(rio->rio_dev, 1),				      ibuf, this_read, &partial,				      (int) (HZ * 8));		dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",		       result, this_read, partial);		if (partial) {			count = this_read = partial;		} else if (result == USB_ST_TIMEOUT || result == 15) {	/* FIXME: 15 ??? */			if (!maxretry--) {				up(&(rio->lock));				err("read_rio: maxretry timeout");				return -ETIME;			}			interruptible_sleep_on_timeout(&rio->wait_q,						       NAK_TIMEOUT);			continue;		} else if (result != USB_ST_DATAUNDERRUN) {			up(&(rio->lock));			err("Read Whoops - result:%u partial:%u this_read:%u",			     result, partial, this_read);			return -EIO;		} else {			up(&(rio->lock));			return (0);		}		if (this_read) {			if (copy_to_user(buffer, ibuf, this_read)) {				up(&(rio->lock));				return -EFAULT;			}			count -= this_read;			read_count += this_read;			buffer += this_read;		}	}	up(&(rio->lock));	return read_count;}static structfile_operations usb_rio_fops = {	read:		read_rio,	write:		write_rio,	ioctl:		ioctl_rio,	open:		open_rio,	release:	close_rio,};static void *probe_rio(struct usb_device *dev, unsigned int ifnum,		       const struct usb_device_id *id){	struct rio_usb_data *rio = &rio_instance;	info("USB Rio found at address %d", dev->devnum);	rio->present = 1;	rio->rio_dev = dev;	if (!(rio->obuf = (char *) kmalloc(OBUF_SIZE, GFP_KERNEL))) {		err("probe_rio: Not enough memory for the output buffer");		return NULL;	}	dbg("probe_rio: obuf address:%p", rio->obuf);	if (!(rio->ibuf = (char *) kmalloc(IBUF_SIZE, GFP_KERNEL))) {		err("probe_rio: Not enough memory for the input buffer");		kfree(rio->obuf);		return NULL;	}	dbg("probe_rio: ibuf address:%p", rio->ibuf);	rio->devfs = devfs_register(usb_devfs_handle, "rio500",				    DEVFS_FL_DEFAULT, USB_MAJOR,				    RIO_MINOR,				    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |				    S_IWGRP, &usb_rio_fops, NULL);	if (rio->devfs == NULL)		dbg("probe_rio: device node registration failed");	init_MUTEX(&(rio->lock));	return rio;}static void disconnect_rio(struct usb_device *dev, void *ptr){	struct rio_usb_data *rio = (struct rio_usb_data *) ptr;	devfs_unregister(rio->devfs);	down(&(rio->lock));	if (rio->isopen) {		rio->isopen = 0;		/* better let it finish - the release will do whats needed */		rio->rio_dev = NULL;		up(&(rio->lock));		return;	}	kfree(rio->ibuf);	kfree(rio->obuf);	info("USB Rio disconnected.");	rio->present = 0;	up(&(rio->lock));}static struct usb_device_id rio_table [] = {	{ USB_DEVICE(0x0841, 1) }, 		/* Rio 500 */	{ }					/* Terminating entry */};MODULE_DEVICE_TABLE (usb, rio_table);static struct usb_driver rio_driver = {	name:		"rio500",	probe:		probe_rio,	disconnect:	disconnect_rio,	fops:		&usb_rio_fops,	minor:		RIO_MINOR,	id_table:	rio_table,};int usb_rio_init(void){	if (usb_register(&rio_driver) < 0)		return -1;	info(DRIVER_VERSION ":" DRIVER_DESC);	return 0;}void usb_rio_cleanup(void){	struct rio_usb_data *rio = &rio_instance;	rio->present = 0;	usb_deregister(&rio_driver);}module_init(usb_rio_init);module_exit(usb_rio_cleanup);MODULE_AUTHOR( DRIVER_AUTHOR );MODULE_DESCRIPTION( DRIVER_DESC );MODULE_LICENSE("GPL");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美高清性hdvideosex| 久久久99精品免费观看不卡| 欧美一级在线观看| 国产精品你懂的| 日本在线观看不卡视频| 成人av免费在线观看| 日韩三级精品电影久久久| 亚洲视频一二三区| 国产成人福利片| 3d成人h动漫网站入口| 亚洲日本乱码在线观看| 国产在线精品一区二区夜色| 91精品办公室少妇高潮对白| 亚洲国产成人一区二区三区| 久久精品国产99国产| 欧美老肥妇做.爰bbww视频| 国产精品久久久久影院老司| 国产麻豆精品一区二区| 日韩一区二区免费在线电影| 亚洲成人免费在线| 在线欧美一区二区| 136国产福利精品导航| 国产成人免费9x9x人网站视频| 这里是久久伊人| 五月综合激情婷婷六月色窝| 色欧美88888久久久久久影院| 中文字幕乱码亚洲精品一区| 久久99热狠狠色一区二区| 91精品久久久久久久久99蜜臂| 一个色在线综合| 日本国产一区二区| 一区二区三区在线观看欧美| 色诱视频网站一区| 亚洲精品免费在线观看| 91蝌蚪porny九色| 亚洲免费av观看| 91美女精品福利| 亚洲美女淫视频| 欧美影院午夜播放| 亚洲一级二级三级| 欧美日韩一区二区三区视频| 亚洲 欧美综合在线网络| 欧美日韩一级片在线观看| 亚洲成av人片一区二区梦乃| 欧美久久久一区| 久久国产精品色| 久久久久久久久久电影| 成人午夜看片网址| 亚洲丝袜美腿综合| 欧美视频在线一区二区三区| 日本美女一区二区| 精品福利一区二区三区 | 欧美成人性福生活免费看| 免费在线观看不卡| 久久青草欧美一区二区三区| 国产成人精品影视| 夜夜嗨av一区二区三区网页 | 精品国产乱码久久久久久久| 日欧美一区二区| 欧美电视剧在线看免费| 国产高清视频一区| 亚洲欧美偷拍另类a∨色屁股| 欧美在线免费观看亚洲| 蜜桃在线一区二区三区| 国产色产综合色产在线视频| 色999日韩国产欧美一区二区| 亚洲123区在线观看| 久久久精品中文字幕麻豆发布| 99精品视频一区二区三区| 五月激情六月综合| 久久久久久久久久久电影| 在线免费观看一区| 韩国v欧美v日本v亚洲v| 亚洲少妇中出一区| 日韩女优av电影| 色哟哟在线观看一区二区三区| 美美哒免费高清在线观看视频一区二区| 日本一区二区综合亚洲| 91 com成人网| 99视频在线观看一区三区| 琪琪久久久久日韩精品| 日韩久久一区二区| 久久你懂得1024| 欧美日韩国产高清一区二区| 成人午夜av电影| 日本亚洲视频在线| 亚洲免费大片在线观看| 国产欧美一区在线| 日韩一级欧美一级| 在线观看日韩一区| 成人综合激情网| 精品一区二区三区视频| 亚洲线精品一区二区三区八戒| 中文字幕不卡在线观看| 91精品国产综合久久婷婷香蕉| 成人美女视频在线看| 精品在线视频一区| 日本视频一区二区三区| 亚洲最新视频在线观看| 国产精品久久久久婷婷| 久久久久一区二区三区四区| 欧美一级久久久| 欧美视频在线不卡| 91久久免费观看| 99久久婷婷国产精品综合| 国产成人精品影院| 国产一区二区三区最好精华液| 日本不卡视频在线观看| 性久久久久久久久久久久| 伊人色综合久久天天人手人婷| 国产精品国产三级国产| 久久久久久久久久看片| 久久综合99re88久久爱| 精品国产网站在线观看| 4438x亚洲最大成人网| 精品视频一区三区九区| 欧美日韩在线播放一区| 欧美三级在线播放| 欧美男生操女生| 欧美精品自拍偷拍| 91精品国产综合久久福利| 欧美一区二区播放| 欧美一区二区三区四区高清| 欧美一区二视频| 欧美哺乳videos| 亚洲精品一区在线观看| 久久综合色婷婷| 国产精品另类一区| 国产精品久久久久精k8| 亚洲视频每日更新| 亚洲成在线观看| 日韩黄色片在线观看| 免费看日韩精品| 国产一区二区主播在线| 成人91在线观看| 色综合色狠狠综合色| 欧美日韩国产片| xfplay精品久久| 亚洲人精品一区| 午夜久久久久久| 国产一级精品在线| 91亚洲永久精品| 欧美理论在线播放| 欧美精品一区二区久久婷婷| 国产日韩在线不卡| 亚洲精品国产一区二区精华液 | 欧美成人艳星乳罩| 亚洲国产精品黑人久久久| 亚洲男帅同性gay1069| 亚洲成a人片在线不卡一二三区 | 亚洲国产视频一区二区| 麻豆精品精品国产自在97香蕉| 成人黄色片在线观看| 欧美在线观看一区| 精品成人一区二区三区四区| 亚洲一区中文在线| 久久99国产精品免费网站| 成人午夜精品一区二区三区| 欧美日韩精品专区| 国产三区在线成人av| 亚洲成在线观看| 成人午夜在线播放| 欧美一区二区三区在线| 中文字幕中文在线不卡住| 午夜影院久久久| 99久久国产综合精品麻豆| 欧美一区二区美女| 亚洲精品国产a| 国产精品一区二区久久精品爱涩| 欧美日韩国产综合久久| 亚洲国产成人一区二区三区| 午夜欧美2019年伦理| 99久久久久久| 久久五月婷婷丁香社区| 午夜视频一区二区| 色综合久久中文综合久久97| 久久精品一区蜜桃臀影院| 日本在线播放一区二区三区| 日本久久一区二区| 国产欧美日韩精品a在线观看| 男男成人高潮片免费网站| 日本福利一区二区| 中文字幕字幕中文在线中不卡视频| 免费人成黄页网站在线一区二区| 在线观看视频一区二区欧美日韩| 国产精品视频一二| 国产福利91精品一区| 日韩午夜av一区| 日韩制服丝袜av| 欧美日韩国产经典色站一区二区三区| 亚洲欧美日韩电影| 波多野结衣在线一区| 久久精品亚洲麻豆av一区二区| 国产成人一区在线| 日韩欧美精品在线| 麻豆精品视频在线观看视频| 欧美一区二区三区四区高清| 五月综合激情网| 欧美精品一卡二卡| 亚洲成人免费视频|