亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产一区二区三区四| 在线精品视频小说1| 欧洲一区在线观看| 久久亚洲一区二区三区明星换脸| 欧美日韩视频专区在线播放| 2020国产精品| 欧美a一区二区| 欧美三级日韩在线| 日韩欧美国产1| 亚洲自拍偷拍欧美| 成人毛片视频在线观看| 色综合一个色综合亚洲| 久久久国产综合精品女国产盗摄| 久久一区二区三区国产精品| 天天色天天爱天天射综合| 色综合久久综合网97色综合| 国产亚洲自拍一区| 国产麻豆精品视频| 精品久久久久久久人人人人传媒| 中文字幕免费不卡| 国产经典欧美精品| 久久青草国产手机看片福利盒子 | 亚洲国产视频在线| 99精品视频一区| 欧美美女一区二区在线观看| 精品久久一区二区| 亚洲区小说区图片区qvod| 成人av网站大全| 欧美国产丝袜视频| 成人av在线一区二区三区| 在线一区二区视频| 久久欧美中文字幕| 国产91精品久久久久久久网曝门| 欧美午夜影院一区| 亚洲午夜免费福利视频| 日本黄色一区二区| 亚洲综合色自拍一区| 欧美揉bbbbb揉bbbbb| 国产精品天干天干在观线 | 7777精品伊人久久久大香线蕉的 | 国产综合久久久久影院| 精品区一区二区| 国产乱码精品一区二区三区五月婷| 色av一区二区| 亚洲一区二区3| 91精品蜜臀在线一区尤物| 六月丁香综合在线视频| 久久久久国产精品人| 99久久亚洲一区二区三区青草| 日韩精品在线一区| 国产精品一区久久久久| 国产精品每日更新在线播放网址| 日本欧美一区二区三区乱码| 精品99999| 99精品国产视频| 偷拍日韩校园综合在线| 久久在线观看免费| 91在线视频免费91| 日韩经典中文字幕一区| 国产日韩精品久久久| 在线一区二区三区四区| 蜜桃av一区二区三区电影| 国产女人aaa级久久久级| 欧美午夜在线观看| 国产精品1024| 日韩高清在线观看| 中文av字幕一区| 欧美精品免费视频| 国产福利一区在线观看| 亚洲国产视频一区二区| 26uuu精品一区二区在线观看| 男人的天堂久久精品| 欧美人妇做爰xxxⅹ性高电影| 亚洲色图.com| 欧美大片一区二区三区| 99久久精品国产导航| 免费在线视频一区| 亚洲精品国久久99热| 欧美成人一区二区三区片免费| 捆绑变态av一区二区三区| 欧美一区二区视频在线观看| 性感美女久久精品| 中文字幕一区日韩精品欧美| 日韩免费电影网站| 欧洲精品视频在线观看| 亚洲综合久久久久| 国产精品免费免费| 日韩片之四级片| 欧美日韩一级大片网址| 99久久伊人久久99| 国产另类ts人妖一区二区| 日韩黄色一级片| 一区二区三区国产精华| 国产精品日日摸夜夜摸av| 日韩精品一区二区三区在线观看| 国内久久精品视频| 免费观看在线综合色| 亚洲一区国产视频| 国产精品久久一级| 久久精品一区二区三区四区| 日韩一级视频免费观看在线| 国产精品一区二区免费不卡| 麻豆精品久久精品色综合| 日韩电影免费在线| 天堂影院一区二区| 亚洲一区免费视频| 亚洲国产日韩精品| 精品美女在线播放| av不卡免费在线观看| 成人性视频免费网站| 亚洲午夜电影在线观看| 一区二区免费在线| 亚洲一区影音先锋| 亚洲男女毛片无遮挡| 亚洲男人的天堂一区二区| 亚洲欧美日韩人成在线播放| 中文字幕一区二区三区精华液 | 自拍视频在线观看一区二区| 中文字幕av一区二区三区高| 国产精品的网站| 91精品国产综合久久精品| 成人综合激情网| 成人av综合一区| 99精品视频在线免费观看| 色吧成人激情小说| 欧美日韩高清在线播放| 91精品国产综合久久福利软件| 成人午夜视频在线| 色先锋久久av资源部| 欧美日韩一区不卡| 精品国产一区久久| 欧美精彩视频一区二区三区| 日韩理论片网站| 亚洲第一成人在线| 蜜臀av性久久久久av蜜臀妖精| 一区二区三区四区五区视频在线观看| 精品国产露脸精彩对白| 亚洲国产精品ⅴa在线观看| **性色生活片久久毛片| 久久综合久久综合久久综合| 国产精品污www在线观看| 亚洲激情网站免费观看| 日韩av在线播放中文字幕| 国产一区二区在线观看免费 | 婷婷夜色潮精品综合在线| 亚洲色图另类专区| 日韩一区精品视频| 亚洲国产精品一区二区久久恐怖片| 日本一二三不卡| 性做久久久久久免费观看欧美| 一区二区三区在线视频免费观看| 国产精品国产三级国产| 天天亚洲美女在线视频| 粉嫩嫩av羞羞动漫久久久| 国产在线日韩欧美| 一本色道久久综合亚洲精品按摩| 91丨国产丨九色丨pron| 欧美一区二区三区视频在线| 欧美日韩精品免费| 国产亚洲一区二区三区四区| 香蕉加勒比综合久久| 天堂av在线一区| 午夜视频在线观看一区二区三区| 午夜欧美在线一二页| 成人中文字幕在线| 日韩一卡二卡三卡四卡| 亚洲精品五月天| 国产一区二区福利视频| 欧美三级一区二区| 91精品国产乱| 亚洲精品日韩综合观看成人91| 亚洲综合成人网| av一区二区三区在线| 欧美精品一区二区三区高清aⅴ| 国产三级久久久| 蜜桃一区二区三区在线观看| 欧美性大战久久久久久久蜜臀| 欧美人牲a欧美精品| 一区二区三区日韩精品视频| 亚洲国产精品嫩草影院| 成人精品免费网站| 欧美精品一区二区三区很污很色的 | 国产亚洲一二三区| 国产精品久久久久久久久图文区| 亚洲免费在线观看| yourporn久久国产精品| 久久婷婷国产综合国色天香| 综合网在线视频| 成人高清视频在线| 国产亚洲欧美在线| 国产精品白丝jk黑袜喷水| 欧美一级在线免费| 青青草97国产精品免费观看无弹窗版| 国内精品写真在线观看| 精品盗摄一区二区三区| 狠狠色狠狠色综合系列| 久久女同性恋中文字幕| 国产传媒日韩欧美成人| 久久精品免费在线观看| 成人av中文字幕|