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

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

?? usbserial.c

?? USB接口轉換成RS232接口驅動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
 * USB Serial Converter driver
 *
 * Copyright (C) 1999, 2000 Greg Kroah-Hartman (greg@kroah.com)
 * Copyright (c) 2000 Peter Berger (pberger@brimson.com)
 * Copyright (c) 2000 Al Borchers (borchers@steinerpoint.com)
 *
 *	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 driver was originally based on the ACM driver by Armin Fuerst (which was 
 * based on a driver by Brad Keryan)
 *
 * See Documentation/usb/usb-serial.txt for more information on using this driver
 *
 * 2001_02_05 gkh
 *	Fixed buffer overflows bug with the generic serial driver.  Thanks to
 *	Todd Squires <squirest@ct0.com> for fixing this.
 *
 * (01/10/2001) gkh
 *	Fixed bug where the generic serial adaptor grabbed _any_ device that was
 *	offered to it.
 *
 * (12/12/2000) gkh
 *	Removed MOD_INC and MOD_DEC from poll and disconnect functions, and
 *	moved them to the serial_open and serial_close functions.
 *	Also fixed bug with there not being a MOD_DEC for the generic driver
 *	(thanks to Gary Brubaker for finding this.)
 *
 * (11/29/2000) gkh
 *	Small NULL pointer initialization cleanup which saves a bit of disk image
 *
 * (11/01/2000) Adam J. Richter
 *	instead of using idVendor/idProduct pairs, usb serial drivers
 *	now identify their hardware interest with usb_device_id tables,
 *	which they usually have anyhow for use with MODULE_DEVICE_TABLE.
 *
 * (10/05/2000) gkh
 *	Fixed bug with urb->dev not being set properly, now that the usb
 *	core needs it.
 * 
 * (09/11/2000) gkh
 *	Removed DEBUG #ifdefs with call to usb_serial_debug_data
 *
 * (08/28/2000) gkh
 *	Added port_lock to port structure.
 *	Added locks for SMP safeness to generic driver
 *	Fixed the ability to open a generic device's port more than once.
 *
 * (07/23/2000) gkh
 *	Added bulk_out_endpointAddress to port structure.
 *
 * (07/19/2000) gkh, pberger, and borchers
 *	Modifications to allow usb-serial drivers to be modules.
 *
 * (07/03/2000) gkh
 *	Added more debugging to serial_ioctl call
 * 
 * (06/25/2000) gkh
 *	Changed generic_write_bulk_callback to not call wake_up_interruptible
 *	directly, but to have port_softint do it at a safer time.
 *
 * (06/23/2000) gkh
 *	Cleaned up debugging statements in a quest to find UHCI timeout bug.
 *
 * (05/22/2000) gkh
 *	Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be 
 *	removed from the individual device source files.
 *
 * (05/03/2000) gkh
 *	Added the Digi Acceleport driver from Al Borchers and Peter Berger.
 * 
 * (05/02/2000) gkh
 *	Changed devfs and tty register code to work properly now. This was based on
 *	the ACM driver changes by Vojtech Pavlik.
 *
 * (04/27/2000) Ryan VanderBijl
 * 	Put calls to *_paranoia_checks into one function.
 * 
 * (04/23/2000) gkh
 *	Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports.
 *	Moved when the startup code printed out the devices that are supported.
 *
 * (04/19/2000) gkh
 *	Added driver for ZyXEL omni.net lcd plus ISDN TA
 *	Made startup info message specify which drivers were compiled in.
 *
 * (04/03/2000) gkh
 *	Changed the probe process to remove the module unload races.
 *	Changed where the tty layer gets initialized to have devfs work nicer.
 *	Added initial devfs support.
 *
 * (03/26/2000) gkh
 *	Split driver up into device specific pieces.
 * 
 * (03/19/2000) gkh
 *	Fixed oops that could happen when device was removed while a program
 *	was talking to the device.
 *	Removed the static urbs and now all urbs are created and destroyed
 *	dynamically.
 *	Reworked the internal interface. Now everything is based on the 
 *	usb_serial_port structure instead of the larger usb_serial structure.
 *	This fixes the bug that a multiport device could not have more than
 *	one port open at one time.
 *
 * (03/17/2000) gkh
 *	Added config option for debugging messages.
 *	Added patch for keyspan pda from Brian Warner.
 *
 * (03/06/2000) gkh
 *	Added the keyspan pda code from Brian Warner <warner@lothar.com>
 *	Moved a bunch of the port specific stuff into its own structure. This
 *	is in anticipation of the true multiport devices (there's a bug if you
 *	try to access more than one port of any multiport device right now)
 *
 * (02/21/2000) gkh
 *	Made it so that any serial devices only have to specify which functions
 *	they want to overload from the generic function calls (great, 
 *	inheritance in C, in a driver, just what I wanted...)
 *	Added support for set_termios and ioctl function calls. No drivers take
 *	advantage of this yet.
 *	Removed the #ifdef MODULE, now there is no module specific code.
 *	Cleaned up a few comments in usb-serial.h that were wrong (thanks again
 *	to Miles Lott).
 *	Small fix to get_free_serial.
 *
 * (02/14/2000) gkh
 *	Removed the Belkin and Peracom functionality from the driver due to
 *	the lack of support from the vendor, and me not wanting people to 
 *	accidenatly buy the device, expecting it to work with Linux.
 *	Added read_bulk_callback and write_bulk_callback to the type structure
 *	for the needs of the FTDI and WhiteHEAT driver.
 *	Changed all reverences to FTDI to FTDI_SIO at the request of Bill
 *	Ryder.
 *	Changed the output urb size back to the max endpoint size to make
 *	the ftdi_sio driver have it easier, and due to the fact that it didn't
 *	really increase the speed any.
 *
 * (02/11/2000) gkh
 *	Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a
 *	patch from Miles Lott (milos@insync.net).
 *	Fixed bug with not restoring the minor range that a device grabs, if
 *	the startup function fails (thanks Miles for finding this).
 *
 * (02/05/2000) gkh
 *	Added initial framework for the Keyspan PDA serial converter so that
 *	Brian Warner has a place to put his code.
 *	Made the ezusb specific functions generic enough that different
 *	devices can use them (whiteheat and keyspan_pda both need them).
 *	Split out a whole bunch of structure and other stuff to a seperate
 *	usb-serial.h file.
 *	Made the Visor connection messages a little more understandable, now
 *	that Miles Lott (milos@insync.net) has gotten the Generic channel to
 *	work. Also made them always show up in the log file.
 * 
 * (01/25/2000) gkh
 *	Added initial framework for FTDI serial converter so that Bill Ryder
 *	has a place to put his code.
 *	Added the vendor specific info from Handspring. Now we can print out
 *	informational debug messages as well as understand what is happening.
 *
 * (01/23/2000) gkh
 *	Fixed problem of crash when trying to open a port that didn't have a
 *	device assigned to it. Made the minor node finding a little smarter,
 *	now it looks to find a continous space for the new device.
 *
 * (01/21/2000) gkh
 *	Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net)
 *	Fixed get_serial_by_minor which was all messed up for multi port 
 *	devices. Fixed multi port problem for generic devices. Now the number
 *	of ports is determined by the number of bulk out endpoints for the
 *	generic device.
 *
 * (01/19/2000) gkh
 *	Removed lots of cruft that was around from the old (pre urb) driver 
 *	interface.
 *	Made the serial_table dynamic. This should save lots of memory when
 *	the number of minor nodes goes up to 256.
 *	Added initial support for devices that have more than one port. 
 *	Added more debugging comments for the Visor, and added a needed 
 *	set_configuration call.
 *
 * (01/17/2000) gkh
 *	Fixed the WhiteHEAT firmware (my processing tool had a bug)
 *	and added new debug loader firmware for it.
 *	Removed the put_char function as it isn't really needed.
 *	Added visor startup commands as found by the Win98 dump.
 * 
 * (01/13/2000) gkh
 *	Fixed the vendor id for the generic driver to the one I meant it to be.
 *
 * (01/12/2000) gkh
 *	Forget the version numbering...that's pretty useless...
 *	Made the driver able to be compiled so that the user can select which
 *	converter they want to use. This allows people who only want the Visor
 *	support to not pay the memory size price of the WhiteHEAT.
 *	Fixed bug where the generic driver (idVendor=0000 and idProduct=0000)
 *	grabbed the root hub. Not good.
 * 
 * version 0.4.0 (01/10/2000) gkh
 *	Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT
 *	device. Added startup function to allow firmware to be downloaded to
 *	a device if it needs to be.
 *	Added firmware download logic to the WhiteHEAT device.
 *	Started to add #defines to split up the different drivers for potential
 *	configuration option.
 *	
 * version 0.3.1 (12/30/99) gkh
 *      Fixed problems with urb for bulk out.
 *      Added initial support for multiple sets of endpoints. This enables
 *      the Handspring Visor to be attached successfully. Only the first
 *      bulk in / bulk out endpoint pair is being used right now.
 *
 * version 0.3.0 (12/27/99) gkh
 *	Added initial support for the Handspring Visor based on a patch from
 *	Miles Lott (milos@sneety.insync.net)
 *	Cleaned up the code a bunch and converted over to using urbs only.
 *
 * version 0.2.3 (12/21/99) gkh
 *	Added initial support for the Connect Tech WhiteHEAT converter.
 *	Incremented the number of ports in expectation of getting the
 *	WhiteHEAT to work properly (4 ports per connection).
 *	Added notification on insertion and removal of what port the
 *	device is/was connected to (and what kind of device it was).
 *
 * version 0.2.2 (12/16/99) gkh
 *	Changed major number to the new allocated number. We're legal now!
 *
 * version 0.2.1 (12/14/99) gkh
 *	Fixed bug that happens when device node is opened when there isn't a
 *	device attached to it. Thanks to marek@webdesign.no for noticing this.
 *
 * version 0.2.0 (11/10/99) gkh
 *	Split up internals to make it easier to add different types of serial 
 *	converters to the code.
 *	Added a "generic" driver that gets it's vendor and product id
 *	from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net)
 *	for the idea and sample code (from the usb scanner driver.)
 *	Cleared up any licensing questions by releasing it under the GNU GPL.
 *
 * version 0.1.2 (10/25/99) gkh
 * 	Fixed bug in detecting device.
 *
 * version 0.1.1 (10/05/99) gkh
 * 	Changed the major number to not conflict with anything else.
 *
 * version 0.1 (09/28/99) gkh
 * 	Can recognize the two different devices and start up a read from
 *	device when asked to. Writes also work. No control signals yet, this
 *	all is vendor specific data (i.e. no spec), also no control for
 *	different baud rates or other bit settings.
 *	Currently we are using the same devid as the acm driver. This needs
 *	to change.
 * 
 */
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/errno.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fcntl.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/smp_lock.h>

#ifdef USB_SERIAL_DEBUG
#define DEBUG
#else
#undef DEBUG
#endif
#include <linux/usb.h>

/* Module information */
MODULE_AUTHOR("Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux-usb/");
MODULE_DESCRIPTION("USB Serial Driver");

#include "usb-serial.h"

#define MAX(a, b) (((a) > (b)) ? (a) : (b))
/* function prototypes for a "generic" type serial converter (no flow control, not all endpoints needed) */

/* need to always compile these in, as some of the other devices use these functions as their own. */

/* if a driver does not provide a function pointer, the generic function will be called. */
static int    generic_open(struct usb_serial_port *port, struct file *filp);
static void   generic_close(struct usb_serial_port *port, struct file *filp);
static int    generic_write(struct usb_serial_port *port, int from_user, const unsigned char *buf, int count);
static int    generic_write_room(struct usb_serial_port *port);
static int    generic_chars_in_buffer(struct usb_serial_port *port);
static void   generic_read_bulk_callback(struct urb *urb);
static void   generic_write_bulk_callback(struct urb *urb);

#ifdef CONFIG_USB_SERIAL_GENERIC
static void   generic_shutdown(struct usb_serial *serial);
static __u16  vendor = 0x05f9;
static __u16  product = 0xffff;
MODULE_PARM(vendor, "i");
MODULE_PARM_DESC(vendor, "User specified USB idVendor");

MODULE_PARM(product, "i");
MODULE_PARM_DESC(product, "User specified USB idProduct");

static struct usb_device_id           generic_device_ids[2];  /* Initially all zeroes. */

/* All of the device info needed for the Generic Serial Converter */
static struct usb_serial_device_type  generic_device =
{
name:
  "Generic",
  id_table : generic_device_ids,
  needs_interrupt_in : DONT_CARE, /* don't have to have an interrupt in endpoint */
  needs_bulk_in : DONT_CARE,      /* don't have to have a bulk in endpoint */
  needs_bulk_out : DONT_CARE,     /* don't have to have a bulk out endpoint */
  num_interrupt_in : NUM_DONT_CARE,
  num_bulk_in : NUM_DONT_CARE,
  num_bulk_out : NUM_DONT_CARE,
  num_ports : 1,
  shutdown : generic_shutdown,
};
#endif

/* local function prototypes */
static int                            serial_open(struct tty_struct *tty, struct file *filp);
static void                           serial_close(struct tty_struct *tty, struct file *filp);
static int                            serial_write(struct tty_struct   *tty, int                 from_user,
                                                   const unsigned char *buf, int                 count);
static int                            serial_write_room(struct tty_struct *tty);
static int                            serial_chars_in_buffer(struct tty_struct *tty);
static void                           serial_throttle(struct tty_struct *tty);
static void                           serial_unthrottle(struct tty_struct *tty);
static int                            serial_ioctl(struct tty_struct *tty, struct file       *file, unsigned int      cmd,
                                                   unsigned long     arg);
static void                           serial_set_termios(struct tty_struct *tty, struct termios *old);

static void                           *usb_serial_probe(struct usb_device           *dev, unsigned int                ifnum,
                                                        const struct usb_device_id  *id);
static void                           usb_serial_disconnect(struct usb_device *dev, void *ptr);

static struct usb_driver              usb_serial_driver =
{
name:
  "serial",
  probe : usb_serial_probe,
  disconnect : usb_serial_disconnect,
  id_table : NULL,                /* check all devices */
};

/* There is no MODULE_DEVICE_TABLE for usbserial.c.  Instead
   the MODULE_DEVICE_TABLE declarations in each serial driver

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜影视影院在线观看| 欧美性一二三区| 精品少妇一区二区三区在线播放| 亚洲国产精品嫩草影院| 欧美日韩二区三区| 日韩福利电影在线| 日韩午夜精品视频| 极品美女销魂一区二区三区| 精品国产一区二区三区忘忧草| 日韩精品91亚洲二区在线观看| 在线不卡一区二区| 麻豆成人久久精品二区三区小说| 久久久久97国产精华液好用吗| 国产大陆a不卡| 亚洲欧洲日韩在线| 欧美亚日韩国产aⅴ精品中极品| 天天综合色天天综合色h| 日韩欧美激情在线| 成+人+亚洲+综合天堂| 一区二区国产盗摄色噜噜| 欧美伦理视频网站| 激情伊人五月天久久综合| 国产色婷婷亚洲99精品小说| 97超碰欧美中文字幕| 天堂在线一区二区| 久久久综合精品| 99久久99久久免费精品蜜臀| 亚洲第一激情av| 久久久精品综合| 91久久精品日日躁夜夜躁欧美| 五月天激情综合| 久久伊人中文字幕| 日本电影欧美片| 麻豆freexxxx性91精品| 中文字幕制服丝袜成人av| 欧美性猛交xxxx乱大交退制版 | 一级精品视频在线观看宜春院| 欧美精品aⅴ在线视频| 国产成+人+日韩+欧美+亚洲 | 亚洲国产wwwccc36天堂| 欧美va亚洲va香蕉在线| 在线免费观看日韩欧美| 蜜臀精品一区二区三区在线观看| 中文字幕在线观看不卡视频| 日韩亚洲欧美高清| 色呦呦日韩精品| 国产精品影视在线观看| 五月综合激情网| 亚洲视频在线一区| 精品国产凹凸成av人网站| 欧美色综合影院| 成人av网站在线| 激情综合网av| 婷婷中文字幕一区三区| 一区在线观看免费| 久久久久亚洲蜜桃| 91精品国产综合久久国产大片| 99国产精品国产精品久久| 日韩精品亚洲一区| 亚洲国产精品欧美一二99| 亚洲手机成人高清视频| 国产三级精品三级| 欧美大肚乱孕交hd孕妇| 欧美乱妇15p| 色菇凉天天综合网| 不卡高清视频专区| 国产精品99久久久久久久女警| 日韩精品一区第一页| 一区二区三区日韩欧美| 日韩理论片网站| 最新不卡av在线| 国产精品久久综合| 国产精品久久二区二区| 日本一二三不卡| 日本一区二区三级电影在线观看 | 欧美另类久久久品| 欧美专区日韩专区| 91福利社在线观看| 欧美主播一区二区三区美女| 色婷婷久久久久swag精品| www.欧美日韩国产在线| 成人福利视频在线看| 成人h动漫精品| 97久久久精品综合88久久| 成人的网站免费观看| heyzo一本久久综合| 99re热视频精品| 91久久精品午夜一区二区| 欧美亚洲国产怡红院影院| 欧美色手机在线观看| 在线观看91av| 欧美成人一级视频| 国产无一区二区| 一区二区中文字幕在线| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲精品成人在线| 午夜久久久影院| 久久 天天综合| 成人小视频免费观看| 99re热视频精品| 7777女厕盗摄久久久| 精品女同一区二区| 国产精品每日更新| 亚洲精品乱码久久久久久| 天天综合天天综合色| 久久不见久久见中文字幕免费| 国产一区二区三区免费| www.日韩大片| 91精品一区二区三区久久久久久 | 亚洲成av人片一区二区三区| 日韩主播视频在线| 国产精品一区二区久激情瑜伽| av电影一区二区| 欧美日韩卡一卡二| 国产午夜精品一区二区三区嫩草 | 国产成人av福利| 在线精品视频免费观看| 日韩一二在线观看| 中文字幕一区二区三区视频| 亚洲国产另类av| 国产宾馆实践打屁股91| 欧洲精品在线观看| 久久影院午夜片一区| 亚洲美腿欧美偷拍| 国产精品一区专区| 欧洲视频一区二区| 欧美国产精品专区| 视频一区在线播放| eeuss国产一区二区三区| 这里只有精品99re| 亚洲天天做日日做天天谢日日欢| 美女久久久精品| 色www精品视频在线观看| 亚洲精品在线观| 亚洲国产色一区| 粉嫩嫩av羞羞动漫久久久 | 久久久国产一区二区三区四区小说| 亚洲精品va在线观看| 免费欧美日韩国产三级电影| 欧美精品一区二区高清在线观看| 成人午夜私人影院| 欧美私人免费视频| 欧美国产日韩一二三区| 蜜臀av一区二区在线观看| 91丨porny丨首页| 亚洲成人7777| 国产在线播放一区三区四| 欧美高清视频一二三区| 亚洲丝袜美腿综合| 国产成人综合在线| 精品奇米国产一区二区三区| 日韩在线观看一区二区| 欧美网站大全在线观看| 最好看的中文字幕久久| 福利电影一区二区| 2020日本不卡一区二区视频| 麻豆传媒一区二区三区| 欧美日韩国产高清一区二区三区| 亚洲精品国产成人久久av盗摄| 99久久精品免费观看| 国产精品色哟哟网站| 国产精品一区免费视频| 久久亚洲一区二区三区四区| 蜜桃视频一区二区三区在线观看| 欧美视频一区在线观看| 亚洲一区二区av在线| 日本大香伊一区二区三区| 一区二区视频免费在线观看| 91香蕉国产在线观看软件| 亚洲欧美在线高清| 95精品视频在线| 亚洲三级电影全部在线观看高清| 成人免费视频app| 国产精品入口麻豆九色| 成人国产视频在线观看| 中文字幕亚洲一区二区va在线| 波多野结衣91| 一区二区三区精品视频在线| 色偷偷久久人人79超碰人人澡| 亚洲综合一区二区| 欧美日韩精品欧美日韩精品一| 亚洲电影一级片| 7777精品伊人久久久大香线蕉最新版 | 亚洲美女在线一区| 欧美伊人精品成人久久综合97| 亚洲资源在线观看| 91精品国产乱| 国产做a爰片久久毛片| 亚洲国产成人在线| 91美女片黄在线| 亚洲一区电影777| 欧美一级高清片在线观看| 国产在线视频一区二区三区| 日本一区二区久久| 一本到三区不卡视频| 日韩黄色免费网站| 久久免费视频一区| 97久久精品人人澡人人爽| 午夜精品一区二区三区免费视频| 欧美大度的电影原声|