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

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

?? bluetty.c

?? linux qt class 類的函數定義
?? C
?? 第 1 頁 / 共 3 頁
字號:
		return -ENODEV;
	}

	dbg(__FUNCTION__ " - %d byte(s)", count);

	if (!bluetooth->open_count) {
		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

	if (from_user) {
		temp_buffer = kmalloc (count, GFP_KERNEL);
		if (temp_buffer == NULL) {
			err (__FUNCTION__ "- out of memory.");
			retval = -ENOMEM;
			goto exit;
		}
		if (copy_from_user (temp_buffer, buf, count)) {
			retval = -EFAULT;
			goto exit;
		}
		current_buffer = temp_buffer;
	} else {
		current_buffer = buf;
	}

	switch (*current_buffer) {
		/* First byte indicates the type of packet */
		case CMD_PKT:
			/* dbg(__FUNCTION__ "- Send cmd_pkt len:%d", count);*/

			retval = bluetooth_ctrl_msg (bluetooth, 0x00, 0x00, &current_buffer[1], count-1);
			if (retval) {
				goto exit;
			}
			retval = count;
			break;

		case ACL_PKT:
			current_position = current_buffer;
			++current_position;
			--count;
			bytes_sent = 0;

			while (count > 0) {
				urb = NULL;

				/* try to find a free urb in our list */
				for (i = 0; i < NUM_BULK_URBS; ++i) {
					if (bluetooth->write_urb_pool[i]->status != -EINPROGRESS) {
						urb = bluetooth->write_urb_pool[i];
						break;
					}
				}
				if (urb == NULL) {
					dbg (__FUNCTION__ " - no free urbs");
					retval = bytes_sent;
					goto exit;
				}
				

				buffer_size = min (count, bluetooth->bulk_out_buffer_size);
				memcpy (urb->transfer_buffer, current_position, buffer_size);

				/* build up our urb */
				FILL_BULK_URB (urb, bluetooth->dev, usb_sndbulkpipe(bluetooth->dev, bluetooth->bulk_out_endpointAddress),
						urb->transfer_buffer, buffer_size, bluetooth_write_bulk_callback, bluetooth);
				urb->transfer_flags |= USB_QUEUE_BULK;

				/* send it down the pipe */
				retval = usb_submit_urb(urb, GFP_KERNEL);
				if (retval) {
					dbg(__FUNCTION__ " - usb_submit_urb(write bulk) failed with error = %d", retval);
					goto exit;
				}
#ifdef BTBUGGYHARDWARE
				/* A workaround for the stalled data bug */
				/* May or may not be needed...*/
				if (count != 0) {
					udelay(500);
				}
#endif
				current_position += buffer_size;
				bytes_sent += buffer_size;
				count -= buffer_size;
			}

			retval = bytes_sent + 1;
			break;
		
		default :
			dbg(__FUNCTION__" - unsupported (at this time) write type");
			retval = -EINVAL;
			break;
	}

exit:
	if (temp_buffer != NULL)
		kfree (temp_buffer);

	return retval;
} 


static int bluetooth_write_room (struct tty_struct *tty) 
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
	int room = 0;
	int i;

	if (!bluetooth) {
		return -ENODEV;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return -EINVAL;
	}

	for (i = 0; i < NUM_BULK_URBS; ++i) {
		if (bluetooth->write_urb_pool[i]->status != -EINPROGRESS) {
			room += bluetooth->bulk_out_buffer_size;
		}
	}

	dbg(__FUNCTION__ " - returns %d", room);
	return room;
}


static int bluetooth_chars_in_buffer (struct tty_struct *tty) 
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
	int chars = 0;
	int i;

	if (!bluetooth) {
		return -ENODEV;
	}

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return -EINVAL;
	}

	for (i = 0; i < NUM_BULK_URBS; ++i) {
		if (bluetooth->write_urb_pool[i]->status == -EINPROGRESS) {
			chars += bluetooth->write_urb_pool[i]->transfer_buffer_length;
		}
	}

	dbg (__FUNCTION__ " - returns %d", chars);
	return chars;
}


static void bluetooth_throttle (struct tty_struct * tty)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);

	if (!bluetooth) {
		return;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return;
	}
	
	dbg(__FUNCTION__ " unsupported (at this time)");

	return;
}


static void bluetooth_unthrottle (struct tty_struct * tty)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);

	if (!bluetooth) {
		return;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return;
	}

	dbg(__FUNCTION__ " unsupported (at this time)");
}


static int bluetooth_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);

	if (!bluetooth) {
		return -ENODEV;
	}

	dbg(__FUNCTION__ " - cmd 0x%.4x", cmd);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return -ENODEV;
	}

	/* FIXME!!! */
	return -ENOIOCTLCMD;
}


static void bluetooth_set_termios (struct tty_struct *tty, struct termios * old)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);

	if (!bluetooth) {
		return;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return;
	}

	/* FIXME!!! */

	return;
}


#ifdef BTBUGGYHARDWARE
void btusb_enable_bulk_read(struct tty_struct *tty){
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
	int result;

	if (!bluetooth) {
		return;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return;
	}

	if (bluetooth->read_urb) {
		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, GFP_KERNEL);
		if (result)
			err (__FUNCTION__ " - failed submitting read urb, error %d", result);
	}
}

void btusb_disable_bulk_read(struct tty_struct *tty){
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);

	if (!bluetooth) {
		return;
	}

	dbg(__FUNCTION__);

	if (!bluetooth->open_count) {
		dbg (__FUNCTION__ " - device not open");
		return;
	}

	if ((bluetooth->read_urb) && (bluetooth->read_urb->actual_length))
		usb_unlink_urb(bluetooth->read_urb);
}
#endif


/*****************************************************************************
 * urb callback functions
 *****************************************************************************/


static void bluetooth_int_callback (struct urb *urb)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
	unsigned char *data = urb->transfer_buffer;
	unsigned int i;
	unsigned int count = urb->actual_length;
	unsigned int packet_size;

	dbg(__FUNCTION__);

	if (!bluetooth) {
		dbg(__FUNCTION__ " - bad bluetooth pointer, exiting");
		return;
	}

	if (urb->status) {
		dbg(__FUNCTION__ " - nonzero int status received: %d", urb->status);
		return;
	}

	if (!count) {
		dbg(__FUNCTION__ " - zero length int");
		return;
	}


#ifdef DEBUG
	if (count) {
		printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ "- length = %d, data = ", count);
		for (i = 0; i < count; ++i) {
			printk ("%.2x ", data[i]);
		}
		printk ("\n");
	}
#endif

#ifdef BTBUGGYHARDWARE
	if ((count >= 2) && (data[0] == 0xFF) && (data[1] == 0x00)) {
		data += 2;
		count -= 2;
	}
	if (count == 0) {
		urb->actual_length = 0;
		return;
	}
#endif
	/* We add  a packet type identifier to the beginning of each
	   HCI frame.  This makes the data in the tty look like a
	   serial USB devices.  Each HCI frame can be broken across
	   multiple URBs so we buffer them until we have a full hci
	   packet */

	if (!bluetooth->int_packet_pos) {
		bluetooth->int_buffer[0] = EVENT_PKT;
		bluetooth->int_packet_pos++;
	}
	
	if (bluetooth->int_packet_pos + count > EVENT_BUFFER_SIZE) {
		err(__FUNCTION__ " - exceeded EVENT_BUFFER_SIZE");
		bluetooth->int_packet_pos = 0;
		return;
	}

	memcpy (&bluetooth->int_buffer[bluetooth->int_packet_pos],
		urb->transfer_buffer, count);
	bluetooth->int_packet_pos += count;
	urb->actual_length = 0;

	if (bluetooth->int_packet_pos >= EVENT_HDR_SIZE)
		packet_size = bluetooth->int_buffer[2];
	else
		return;

	if (packet_size + EVENT_HDR_SIZE < bluetooth->int_packet_pos) {
		err(__FUNCTION__ " - packet was too long");
		bluetooth->int_packet_pos = 0;
		return;
	}

	if (packet_size + EVENT_HDR_SIZE == bluetooth->int_packet_pos) {
		for (i = 0; i < bluetooth->int_packet_pos; ++i) {
			/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them */
			if (bluetooth->tty->flip.count >= TTY_FLIPBUF_SIZE) {
				tty_flip_buffer_push(bluetooth->tty);
			}
			tty_insert_flip_char(bluetooth->tty, bluetooth->int_buffer[i], 0);
		}
		tty_flip_buffer_push(bluetooth->tty);

		bluetooth->int_packet_pos = 0;
	}
}


static void bluetooth_ctrl_callback (struct urb *urb)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);

	dbg(__FUNCTION__);

	if (!bluetooth) {
		dbg(__FUNCTION__ " - bad bluetooth pointer, exiting");
		return;
	}

	if (urb->status) {
		dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status);
		return;
	}
}


static void bluetooth_read_bulk_callback (struct urb *urb)
{
	struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
	unsigned char *data = urb->transfer_buffer;
	unsigned int count = urb->actual_length;
	unsigned int i;
	unsigned int packet_size;
	int result;


	dbg(__FUNCTION__);

	if (!bluetooth) {
		dbg(__FUNCTION__ " - bad bluetooth pointer, exiting");
		return;
	}

	if (urb->status) {
		dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status);
		if (urb->status == -ENOENT) {                   
			dbg(__FUNCTION__ " - URB canceled, won't reschedule");
			return;
		}
		goto exit;
	}

	if (!count) {
		dbg(__FUNCTION__ " - zero length read bulk");
		goto exit;
	}

#ifdef DEBUG
	if (count) {
		printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ "- length = %d, data = ", count);
		for (i = 0; i < count; ++i) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产清纯美女被跳蛋高潮一区二区久久w| 麻豆国产精品777777在线| 日韩免费高清视频| 日韩视频在线你懂得| 久久精品网站免费观看| 亚洲欧美偷拍另类a∨色屁股| 亚洲女人小视频在线观看| 伊人色综合久久天天人手人婷| 亚洲综合免费观看高清在线观看| 精品一区二区久久| 国产一区二区按摩在线观看| 免费看欧美女人艹b| 国产不卡在线播放| 国产一区日韩二区欧美三区| 久久精品欧美日韩精品| 久久久午夜精品理论片中文字幕| 高清av一区二区| 国产乱理伦片在线观看夜一区| 国产日产亚洲精品系列| 欧美人体做爰大胆视频| 国产一区二区在线电影| 国产精品久久久久久久久免费桃花 | 亚洲精品在线一区二区| 成人一二三区视频| 亚洲精品日韩一| 日韩欧美激情在线| 91亚洲精品久久久蜜桃| 美女尤物国产一区| 亚洲精品国产品国语在线app| 日韩写真欧美这视频| 欧美视频在线观看一区二区| 成人高清伦理免费影院在线观看| 一区二区三区中文字幕电影| 26uuu精品一区二区在线观看| 在线观看亚洲专区| 91啪九色porn原创视频在线观看| 狠狠色狠狠色合久久伊人| 亚洲成a天堂v人片| 亚洲一区二区五区| 最新中文字幕一区二区三区| 国产亚洲视频系列| 日韩免费看的电影| 日韩欧美在线一区二区三区| 欧美日韩国产综合草草| 色婷婷久久久综合中文字幕| 粉嫩欧美一区二区三区高清影视 | 亚洲一区二区精品视频| 一区二区三区精品视频在线| 亚洲欧美综合另类在线卡通| 国产精品久久久久9999吃药| 中文成人av在线| 亚洲柠檬福利资源导航| 洋洋成人永久网站入口| 亚洲精选一二三| 午夜成人在线视频| 久久不见久久见免费视频1| 久久精品噜噜噜成人av农村| 国产一区二区福利视频| 岛国av在线一区| 欧美性高清videossexo| 欧美一区二区在线免费观看| 精品精品国产高清a毛片牛牛| 午夜精品aaa| 久久99国产精品久久99| 在线一区二区三区四区| 777a∨成人精品桃花网| 中文字幕欧美国产| 亚洲国产精品久久一线不卡| 精品一区二区三区在线播放视频| a美女胸又www黄视频久久| 在线电影一区二区三区| 国产欧美日韩综合| 日韩和欧美的一区| 99精品国产视频| 欧美草草影院在线视频| 亚洲影视在线观看| 国产91高潮流白浆在线麻豆| 欧美日韩精品一区二区天天拍小说| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲综合丁香婷婷六月香| 国产精品中文字幕欧美| 6080日韩午夜伦伦午夜伦| 综合色天天鬼久久鬼色| 国产一区91精品张津瑜| 91精品国产麻豆国产自产在线 | 欧美老肥妇做.爰bbww| 亚洲免费大片在线观看| 国产成人在线看| 久久婷婷综合激情| 亚洲成人黄色影院| 不卡视频在线看| 亚洲精品免费播放| 欧美日韩精品欧美日韩精品| 爽好多水快深点欧美视频| 欧美日本国产视频| 九色|91porny| 久久综合av免费| 99久久婷婷国产综合精品电影| 久久奇米777| 91麻豆国产在线观看| 天天射综合影视| 高清不卡一区二区在线| 91激情五月电影| 亚洲综合色网站| 欧美精品视频www在线观看| 香蕉加勒比综合久久| 欧美日韩一区二区不卡| 亚洲精品视频在线观看免费| 97se亚洲国产综合在线| 亚洲图片激情小说| 欧美在线看片a免费观看| 午夜精品久久久久久| 一区二区三区不卡视频| 欧美日韩一二区| 国产一区二区按摩在线观看| 亚洲欧洲性图库| 欧美人成免费网站| 国产精品一区二区在线播放| 中文字幕一区二区三中文字幕| 日本高清成人免费播放| 久久99精品久久久久| 一区二区三区在线视频免费 | 欧美性videosxxxxx| 亚洲一区二区精品久久av| av一区二区三区在线| 秋霞电影网一区二区| 国产欧美精品国产国产专区| 一本久久综合亚洲鲁鲁五月天| 久久国产精品露脸对白| 亚洲精品成人少妇| 亚洲一区二区在线免费观看视频| 国产欧美日本一区二区三区| 51午夜精品国产| 欧美色图在线观看| 久久久午夜电影| 国产成人鲁色资源国产91色综 | 另类欧美日韩国产在线| 亚洲视频1区2区| 亚洲成av人在线观看| 精品国产一区二区三区四区四| 欧美日本在线一区| 在线视频一区二区免费| 91国产精品成人| 欧洲在线/亚洲| 欧美四级电影在线观看| 69堂亚洲精品首页| 欧美美女bb生活片| 欧美成人性福生活免费看| 久久综合九色综合97_久久久| 国产女同互慰高潮91漫画| 久久精品欧美一区二区三区麻豆| 中文字幕不卡三区| 亚洲女女做受ⅹxx高潮| 亚洲成av人片观看| 国产真实乱偷精品视频免| 菠萝蜜视频在线观看一区| 欧洲一区在线电影| 日韩女同互慰一区二区| 粉嫩绯色av一区二区在线观看| 亚洲图片欧美色图| 亚洲男女毛片无遮挡| 中文字幕+乱码+中文字幕一区| 免费人成精品欧美精品| 在线亚洲一区观看| 国产精品全国免费观看高清| 日韩黄色免费网站| 色综合久久六月婷婷中文字幕| 国产亚洲va综合人人澡精品| 一个色妞综合视频在线观看| 久久精品国产亚洲一区二区三区| gogogo免费视频观看亚洲一| 欧美日韩精品一区二区三区蜜桃| 国产精品麻豆一区二区| 激情欧美日韩一区二区| 欧美一个色资源| 综合在线观看色| bt7086福利一区国产| 日本一区免费视频| 高清shemale亚洲人妖| 久久精品视频在线看| 免费观看日韩电影| 日韩欧美在线网站| 天天综合天天综合色| 欧美日韩久久一区| 一区二区三区加勒比av| 色综合中文综合网| 亚洲国产精品99久久久久久久久| 亚洲国产欧美在线人成| 欧美性猛交xxxxxxxx| 亚洲精品久久久蜜桃| 99国产精品国产精品久久| 欧美激情一区二区三区在线| 另类调教123区| 国产区在线观看成人精品| 波多野结衣精品在线| 中文字幕欧美国产| 一本大道av伊人久久综合| 国产精品乱码人人做人人爱| av午夜一区麻豆| 亚洲伦在线观看|