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

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

?? bluetooth.c

?? 講述linux的初始化過程
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * bluetooth.c   Version 0.7 * * Copyright (c) 2000 Greg Kroah-Hartman	<greg@kroah.com> * Copyright (c) 2000 Mark Douglas Corner	<mcorner@umich.edu> * * USB Bluetooth driver, based on the Bluetooth Spec version 1.0B * * (11/29/2000) Version 0.7 gkh *	Fixed problem with overrunning the tty flip buffer. *	Removed unneeded NULL pointer initialization. * * (10/05/2000) Version 0.6 gkh *	Fixed bug with urb->dev not being set properly, now that the usb *	core needs it. *	Got a real major id number and name. * * (08/06/2000) Version 0.5 gkh *	Fixed problem of not resubmitting the bulk read urb if there is *	an error in the callback.  Ericsson devices seem to need this. * * (07/11/2000) Version 0.4 gkh *	Fixed bug in disconnect for when we call tty_hangup *	Fixed bug in bluetooth_ctrl_msg where the bluetooth struct was not *	getting attached to the control urb properly. *	Fixed bug in bluetooth_write where we pay attention to the result *	of bluetooth_ctrl_msg. * * (08/03/2000) Version 0.3 gkh mdc *	Merged in Mark's changes to make the driver play nice with the Axis *	stack. *	Made the write bulk use an urb pool to enable larger transfers with *	fewer calls to the driver. *	Fixed off by one bug in acl pkt receive *	Made packet counters specific to each bluetooth device  *	Added checks for zero length callbacks *	Added buffers for int and bulk packets.  Had to do this otherwise  *	packet types could intermingle. *	Made a control urb pool for the control messages. * * (07/11/2000) Version 0.2 gkh *	Fixed a small bug found by Nils Faerber in the usb_bluetooth_probe  *	function. * * (07/09/2000) Version 0.1 gkh *	Initial release. Has support for sending ACL data (which is really just *	a HCI frame.) Raw HCI commands and HCI events are not supported. *	A ioctl will probably be needed for the HCI commands and events in the *	future. All isoch endpoints are ignored at this time also. *	This driver should work for all currently shipping USB Bluetooth  *	devices at this time :) *  *//* * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#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/malloc.h>#include <linux/fcntl.h>#include <linux/tty_driver.h>#include <linux/tty_flip.h>#include <linux/tty.h>#include <linux/module.h>#define DEBUG#include <linux/usb.h>/* Module information */MODULE_AUTHOR("Greg Kroah-Hartman, Mark Douglas Corner");MODULE_DESCRIPTION("USB Bluetooth driver");/* define this if you have hardware that is not good *//*#define	BTBUGGYHARDWARE *//* Class, SubClass, and Protocol codes that describe a Bluetooth device */#define WIRELESS_CLASS_CODE			0xe0#define RF_SUBCLASS_CODE			0x01#define BLUETOOTH_PROGRAMMING_PROTOCOL_CODE	0x01#define BLUETOOTH_TTY_MAJOR	216	/* real device node major id */#define BLUETOOTH_TTY_MINORS	256	/* whole lotta bluetooth devices */#define USB_BLUETOOTH_MAGIC	0x6d02	/* magic number for bluetooth struct */#define BLUETOOTH_CONTROL_REQUEST_TYPE	0x20/* Bluetooth packet types */#define CMD_PKT			0x01#define ACL_PKT			0x02#define SCO_PKT			0x03#define EVENT_PKT		0x04#define ERROR_PKT		0x05#define NEG_PKT			0x06/* Message sizes */#define MAX_EVENT_SIZE		0xFF#define EVENT_HDR_SIZE		3	/* 2 for the header + 1 for the type indicator */#define EVENT_BUFFER_SIZE	(MAX_EVENT_SIZE + EVENT_HDR_SIZE)#define MAX_ACL_SIZE		0xFFFF#define ACL_HDR_SIZE		5	/* 4 for the header + 1 for the type indicator */#define ACL_BUFFER_SIZE		(MAX_ACL_SIZE + ACL_HDR_SIZE)/* parity check flag */#define RELEVANT_IFLAG(iflag)	(iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))#define CHAR2INT16(c1,c0)	(((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff))#define MIN(a,b)		(((a)<(b))?(a):(b))#define NUM_BULK_URBS		24#define NUM_CONTROL_URBS	16struct usb_bluetooth {	int			magic;	struct usb_device *	dev;	struct tty_driver *	tty_driver;	/* the tty_driver for this device */	struct tty_struct *	tty;		/* the coresponding tty for this port */	unsigned char		minor;		/* the starting minor number for this device */	char			active;		/* someone has this device open */	int			throttle;	/* throttled by tty layer */		__u8			control_out_bInterfaceNum;	struct urb *		control_urb_pool[NUM_CONTROL_URBS];	devrequest		dr[NUM_CONTROL_URBS];	unsigned char *		interrupt_in_buffer;	struct urb *		interrupt_in_urb;	__u8			interrupt_in_endpointAddress;	__u8			interrupt_in_interval;	int			interrupt_in_buffer_size;	unsigned char *		bulk_in_buffer;	struct urb *		read_urb;	__u8			bulk_in_endpointAddress;	int			bulk_in_buffer_size;	int			bulk_out_buffer_size;	struct urb *		write_urb_pool[NUM_BULK_URBS];	__u8			bulk_out_endpointAddress;	wait_queue_head_t	write_wait;	struct tq_struct	tqueue;		/* task queue for line discipline waking up */		unsigned int		int_packet_pos;	unsigned char		int_buffer[EVENT_BUFFER_SIZE];	unsigned int		bulk_packet_pos;	unsigned char		bulk_buffer[ACL_BUFFER_SIZE];	/* 64k preallocated, fix? */};/* local function prototypes */static int  bluetooth_open		(struct tty_struct *tty, struct file *filp);static void bluetooth_close		(struct tty_struct *tty, struct file *filp);static int  bluetooth_write		(struct tty_struct *tty, int from_user, const unsigned char *buf, int count);static int  bluetooth_write_room	(struct tty_struct *tty);static int  bluetooth_chars_in_buffer	(struct tty_struct *tty);static void bluetooth_throttle		(struct tty_struct *tty);static void bluetooth_unthrottle	(struct tty_struct *tty);static int  bluetooth_ioctl		(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);static void bluetooth_set_termios	(struct tty_struct *tty, struct termios *old);static void bluetooth_int_callback		(struct urb *urb);static void bluetooth_ctrl_callback		(struct urb *urb);static void bluetooth_read_bulk_callback	(struct urb *urb);static void bluetooth_write_bulk_callback	(struct urb *urb);static void * usb_bluetooth_probe(struct usb_device *dev, unsigned int ifnum,			 	  const struct usb_device_id *id);static void usb_bluetooth_disconnect	(struct usb_device *dev, void *ptr);static struct usb_device_id usb_bluetooth_ids [] = {	{ USB_DEVICE_INFO(WIRELESS_CLASS_CODE, RF_SUBCLASS_CODE, BLUETOOTH_PROGRAMMING_PROTOCOL_CODE) },	{ }						/* Terminating entry */};MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);static struct usb_driver usb_bluetooth_driver = {	name:		"bluetooth",	probe:		usb_bluetooth_probe,	disconnect:	usb_bluetooth_disconnect,	id_table:	usb_bluetooth_ids,};static int			bluetooth_refcount;static struct tty_driver	bluetooth_tty_driver;static struct tty_struct *	bluetooth_tty[BLUETOOTH_TTY_MINORS];static struct termios *		bluetooth_termios[BLUETOOTH_TTY_MINORS];static struct termios *		bluetooth_termios_locked[BLUETOOTH_TTY_MINORS];static struct usb_bluetooth	*bluetooth_table[BLUETOOTH_TTY_MINORS];static inline int bluetooth_paranoia_check (struct usb_bluetooth *bluetooth, const char *function){	if (!bluetooth) {		dbg("%s - bluetooth == NULL", function);		return -1;	}	if (bluetooth->magic != USB_BLUETOOTH_MAGIC) {		dbg("%s - bad magic number for bluetooth", function);		return -1;	}	return 0;}static inline struct usb_bluetooth* get_usb_bluetooth (struct usb_bluetooth *bluetooth, const char *function){	if (!bluetooth || 	    bluetooth_paranoia_check (bluetooth, function)) { 		/* then say that we dont have a valid usb_bluetooth thing, which will		 * end up generating -ENODEV return values */		return NULL;	}	return bluetooth;}static inline struct usb_bluetooth *get_bluetooth_by_minor (int minor){	return bluetooth_table[minor];}static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int value, void *buf, int len){	struct urb *urb = NULL;	devrequest *dr = NULL;	int i;	int status;	dbg (__FUNCTION__);	/* try to find a free urb in our list */	for (i = 0; i < NUM_CONTROL_URBS; ++i) {		if (bluetooth->control_urb_pool[i]->status != -EINPROGRESS) {			urb = bluetooth->control_urb_pool[i];			dr = &bluetooth->dr[i];			break;		}	}	if (urb == NULL) {		dbg (__FUNCTION__ " - no free urbs");		return -ENOMEM;	}	/* free up the last buffer that this urb used */	if (urb->transfer_buffer != NULL) {		kfree(urb->transfer_buffer);		urb->transfer_buffer = NULL;	}	dr->requesttype = BLUETOOTH_CONTROL_REQUEST_TYPE;	dr->request = request;	dr->value = cpu_to_le16p(&value);	dr->index = cpu_to_le16p(&bluetooth->control_out_bInterfaceNum);	dr->length = cpu_to_le16p(&len);		FILL_CONTROL_URB (urb, bluetooth->dev, usb_sndctrlpipe(bluetooth->dev, 0),			  (unsigned char*)dr, buf, len, bluetooth_ctrl_callback, bluetooth);	/* send it down the pipe */	status = usb_submit_urb(urb);	if (status)		dbg(__FUNCTION__ " - usb_submit_urb(control) failed with status = %d", status);		return 0;}/***************************************************************************** * Driver tty interface functions *****************************************************************************/static int bluetooth_open (struct tty_struct *tty, struct file * filp){	struct usb_bluetooth *bluetooth;	int result;	dbg(__FUNCTION__);	/* initialize the pointer incase something fails */	tty->driver_data = NULL;	/* get the bluetooth object associated with this tty pointer */	bluetooth = get_bluetooth_by_minor (MINOR(tty->device));	if (bluetooth_paranoia_check (bluetooth, __FUNCTION__)) {		return -ENODEV;	}	if (bluetooth->active) {		dbg (__FUNCTION__ " - device already open");		return -EINVAL;	}	/* set up our structure making the tty driver remember our object, and us it */	tty->driver_data = bluetooth;	bluetooth->tty = tty;	/* force low_latency on so that our tty_push actually forces the data through, 	 * otherwise it is scheduled, and with high data rates (like with OHCI) data	 * can get lost. */	bluetooth->tty->low_latency = 1;		bluetooth->active = 1;	/* Reset the packet position counters */	bluetooth->int_packet_pos = 0;	bluetooth->bulk_packet_pos = 0;#ifndef BTBUGGYHARDWARE	/* Start reading from the device */	FILL_BULK_URB(bluetooth->read_urb, bluetooth->dev, 		      usb_rcvbulkpipe(bluetooth->dev, bluetooth->bulk_in_endpointAddress),		      bluetooth->bulk_in_buffer, bluetooth->bulk_in_buffer_size, 		      bluetooth_read_bulk_callback, bluetooth);	result = usb_submit_urb(bluetooth->read_urb);	if (result)		dbg(__FUNCTION__ " - usb_submit_urb(read bulk) failed with status %d", result);#endif	FILL_INT_URB(bluetooth->interrupt_in_urb, bluetooth->dev, 		     usb_rcvintpipe(bluetooth->dev, bluetooth->interrupt_in_endpointAddress),		     bluetooth->interrupt_in_buffer, bluetooth->interrupt_in_buffer_size, 		     bluetooth_int_callback, bluetooth, bluetooth->interrupt_in_interval);	result = usb_submit_urb(bluetooth->interrupt_in_urb);	if (result)		dbg(__FUNCTION__ " - usb_submit_urb(interrupt in) failed with status %d", result);	return 0;}static void bluetooth_close (struct tty_struct *tty, struct file * filp){	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);	int i;	if (!bluetooth) {		return;	}	dbg(__FUNCTION__);	if (!bluetooth->active) {		dbg (__FUNCTION__ " - device not opened");		return;	}	/* shutdown any bulk reads and writes that might be going on */	for (i = 0; i < NUM_BULK_URBS; ++i)		usb_unlink_urb (bluetooth->write_urb_pool[i]);	usb_unlink_urb (bluetooth->read_urb);	bluetooth->active = 0;}static int bluetooth_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count){	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);	struct urb *urb = NULL;	unsigned char *new_buffer;	const unsigned char *current_position;	int status;	int bytes_sent;	int buffer_size;	int i;	if (!bluetooth) {		return -ENODEV;	}	dbg(__FUNCTION__ " - %d byte(s)", count);	if (!bluetooth->active) {		dbg (__FUNCTION__ " - device not opened");		return -EINVAL;	}	if (count == 0) {		dbg(__FUNCTION__ " - write request of 0 bytes");		return 0;	}	if (count == 1) {		dbg(__FUNCTION__ " - write request only included type %d", buf[0]);		return 1;	}#ifdef DEBUG	printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ " - length = %d, data = ", count);	for (i = 0; i < count; ++i) {		printk ("%.2x ", buf[i]);	}	printk ("\n");#endif	switch (*buf) {		/* First byte indicates the type of packet */		case CMD_PKT:			/* dbg(__FUNCTION__ "- Send cmd_pkt len:%d", count);*/			if (in_interrupt()){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费三区一区二区| 99久久精品一区| 国产成人精品影视| 91视频com| 欧美一级黄色录像| 国产精品乱码人人做人人爱| 亚洲精品成人少妇| 性做久久久久久免费观看欧美| 日韩中文字幕区一区有砖一区 | 欧美在线观看一二区| 欧美高清激情brazzers| 欧美激情一区不卡| 一区二区国产视频| 丁香网亚洲国际| 欧美日韩免费电影| 国产精品久久久久影院色老大| 午夜精品久久久久久久久久久| 成人午夜大片免费观看| 欧美午夜免费电影| 欧美国产日韩在线观看| 日本欧美一区二区三区乱码| 成人黄页毛片网站| 欧美成人vps| 最新久久zyz资源站| 另类小说色综合网站| 色88888久久久久久影院按摩| 久久精品亚洲麻豆av一区二区 | 久久久久国产精品人| 水野朝阳av一区二区三区| 成人激情视频网站| 精品国精品国产| 日韩av一区二区三区四区| 色国产精品一区在线观看| 久久久国产精品麻豆| 久久99九九99精品| 欧美疯狂做受xxxx富婆| 亚洲欧美日韩人成在线播放| 国产成人精品三级| 久久久99精品免费观看不卡| 日韩美女久久久| 91色视频在线| 亚洲免费观看高清完整版在线观看 | 在线国产亚洲欧美| 亚洲黄色小视频| 一本大道久久a久久综合| 国产精品网曝门| 高清国产一区二区| 国产欧美日韩综合| 成人激情综合网站| 久久一区二区三区四区| 国产曰批免费观看久久久| 欧美刺激午夜性久久久久久久| 三级亚洲高清视频| 欧美日韩国产色站一区二区三区| 亚洲影视在线观看| 欧美日韩五月天| 亚洲无人区一区| 欧美性猛片aaaaaaa做受| 亚洲狠狠爱一区二区三区| 欧美系列一区二区| 日本视频免费一区| 日韩欧美激情一区| 国产大片一区二区| 自拍偷在线精品自拍偷无码专区| 国产精品综合av一区二区国产馆| 亚洲精品一区二区三区精华液 | 欧美狂野另类xxxxoooo| 午夜a成v人精品| 精品日韩99亚洲| 成人av动漫在线| 亚洲影视在线观看| 久久尤物电影视频在线观看| 国产精品18久久久久久久久 | 久久久久久一级片| 99久久国产免费看| 国产偷国产偷亚洲高清人白洁 | 色婷婷精品大在线视频| 日韩精品一区二区三区在线| 亚洲国产精华液网站w| 黄色小说综合网站| 国产网红主播福利一区二区| 日本麻豆一区二区三区视频| 亚洲视频在线一区观看| 日韩一区二区视频在线观看| 久久精品欧美日韩| 粉嫩蜜臀av国产精品网站| 亚洲视频在线一区| 日韩一区二区三区免费看| 色一区在线观看| 国产精品一二三区| 岛国一区二区在线观看| av高清久久久| 91精品免费观看| 中文字幕电影一区| 亚洲一区二区av电影| 蜜桃91丨九色丨蝌蚪91桃色| 成人免费黄色大片| 欧美一区二区三区成人| 欧美精品一区二区三区高清aⅴ| 精品国产乱码91久久久久久网站| 色av综合在线| 欧美日韩二区三区| 色综合av在线| 欧美色图一区二区三区| 93久久精品日日躁夜夜躁欧美| 五月婷婷激情综合网| 亚洲一区在线视频| 美女脱光内衣内裤视频久久影院| 秋霞电影一区二区| 亚洲成av人**亚洲成av**| 亚洲色图第一区| 精品国产乱码久久久久久老虎 | 免费在线观看视频一区| 亚洲成va人在线观看| 亚洲国产视频a| 一区二区免费在线| 伊人夜夜躁av伊人久久| 亚洲黄色av一区| 亚洲一区二区三区在线看| 亚洲人快播电影网| 亚洲日本一区二区三区| 国产精品美女久久久久久久| 国产精品免费视频一区| 国产女主播视频一区二区| 国产欧美一区二区精品性色| 欧美国产成人在线| 国产精品美女久久久久久久 | 91蝌蚪国产九色| 91蜜桃免费观看视频| 在线视频一区二区免费| 欧美嫩在线观看| 欧美精品一区二区三区在线| 精品99久久久久久| 国产精品久久久久久久蜜臀| 亚洲欧美在线另类| 亚洲h动漫在线| 亚洲高清一区二区三区| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 国产三级精品三级在线专区| 91精品久久久久久久久99蜜臂| 国产精品毛片高清在线完整版 | 精品噜噜噜噜久久久久久久久试看| 亚洲三级在线免费| 三级一区在线视频先锋| 久久99国产精品久久99| 国产乱码精品1区2区3区| 国产一区二区福利| 欧美r级在线观看| 日韩成人一级片| 欧美日韩在线电影| 三级一区在线视频先锋 | 日韩国产精品久久久久久亚洲| 精品视频免费在线| 国产成+人+日韩+欧美+亚洲| 男女男精品网站| 香蕉久久夜色精品国产使用方法| 久久免费午夜影院| 精品少妇一区二区三区| 欧美日本高清视频在线观看| 91浏览器入口在线观看| 日本成人在线看| 欧美男男青年gay1069videost | 欧美性猛交一区二区三区精品| 亚洲精品欧美激情| 欧美日韩一区视频| 亚洲黄色片在线观看| 欧美一区二区三区在线看| 麻豆精品国产91久久久久久| 国产欧美日韩视频在线观看| 91麻豆免费视频| 首页国产欧美久久| 久久男人中文字幕资源站| 午夜精品一区二区三区电影天堂| 欧美精品tushy高清| www.日本不卡| 三级久久三级久久久| 欧美日韩国产免费一区二区 | 懂色av一区二区三区免费看| 国产精品嫩草久久久久| 国产91精品一区二区麻豆网站| 精品国产一区二区在线观看| 懂色av一区二区三区蜜臀| 国产精品午夜春色av| 91麻豆精品国产综合久久久久久 | 精品女同一区二区| 99久久免费视频.com| 99久久久国产精品免费蜜臀| 99麻豆久久久国产精品免费 | 91精品久久久久久蜜臀| 日韩欧美中文字幕公布| 日韩美女视频19| 日本怡春院一区二区| 狠狠色综合日日| 不卡一区二区在线| 国产91对白在线观看九色| 免费看欧美美女黄的网站| ...xxx性欧美| 久久久一区二区| 精品99999| 国产日韩欧美精品一区|