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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hciattach.c

?? 基于LINUX內(nèi)核驅(qū)動的開發(fā)
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * *  BlueZ - Bluetooth protocol stack for Linux * *  Copyright (C) 2000-2001  Qualcomm Incorporated *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com> *  Copyright (C) 2002-2008  Marcel Holtmann <marcel@holtmann.org> * * *  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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA * */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#include <errno.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <signal.h>#include <syslog.h>#include <termios.h>#include <time.h>#include <sys/time.h>#include <sys/poll.h>#include <sys/param.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <bluetooth/bluetooth.h>#include <bluetooth/hci.h>#include <bluetooth/hci_lib.h>#ifndef N_HCI#define N_HCI	15#endif#define HCIUARTSETPROTO		_IOW('U', 200, int)#define HCIUARTGETPROTO		_IOR('U', 201, int)#define HCIUARTGETDEVICE	_IOR('U', 202, int)#define HCI_UART_H4	0#define HCI_UART_BCSP	1#define HCI_UART_3WIRE	2#define HCI_UART_H4DS	3struct uart_t {	char *type;	int  m_id;	int  p_id;	int  proto;	int  init_speed;	int  speed;	int  flags;	char *bdaddr;	int  (*init) (int fd, struct uart_t *u, struct termios *ti);};#define FLOW_CTL	0x0001static volatile sig_atomic_t __io_canceled = 0;static void sig_hup(int sig){}static void sig_term(int sig){	__io_canceled = 1;}static void sig_alarm(int sig){	fprintf(stderr, "Initialization timed out.\n");	exit(1);}static int uart_speed(int s){	switch (s) {	case 9600:		return B9600;	case 19200:		return B19200;	case 38400:		return B38400;	case 57600:		return B57600;	case 115200:		return B115200;	case 230400:		return B230400;	case 460800:		return B460800;	case 500000:		return B500000;	case 576000:		return B576000;	case 921600:		return B921600;	case 1000000:		return B1000000;	case 1152000:		return B1152000;	case 1500000:		return B1500000;	case 2000000:		return B2000000;#ifdef B2500000	case 2500000:		return B2500000;#endif#ifdef B3000000	case 3000000:		return B3000000;#endif#ifdef B3500000	case 3500000:		return B3500000;#endif#ifdef B4000000	case 4000000:		return B4000000;#endif	default:		return B57600;	}}static int set_speed(int fd, struct termios *ti, int speed){	cfsetospeed(ti, uart_speed(speed));	return tcsetattr(fd, TCSANOW, ti);}/*  * Read an HCI event from the given file descriptor. */static int read_hci_event(int fd, unsigned char* buf, int size) {	int remain, r;	int count = 0;	if (size <= 0)		return -1;	/* The first byte identifies the packet type. For HCI event packets, it	 * should be 0x04, so we read until we get to the 0x04. */	while (1) {		r = read(fd, buf, 1);		if (r <= 0)			return -1;		if (buf[0] == 0x04)			break;	}	count++;	/* The next two bytes are the event code and parameter total length. */	while (count < 3) {		r = read(fd, buf + count, 3 - count);		if (r <= 0)			return -1;		count += r;	}	/* Now we read the parameters. */	if (buf[2] < (size - 3)) 		remain = buf[2];	else 		remain = size - 3;	while ((count - 3) < remain) {		r = read(fd, buf + count, remain - (count - 3));		if (r <= 0)			return -1;		count += r;	}	return count;}/*  * Ericsson specific initialization  */static int ericsson(int fd, struct uart_t *u, struct termios *ti){	struct timespec tm = {0, 50000};	char cmd[5];	cmd[0] = HCI_COMMAND_PKT;	cmd[1] = 0x09;	cmd[2] = 0xfc;	cmd[3] = 0x01;	switch (u->speed) {	case 57600:		cmd[4] = 0x03;		break;	case 115200:		cmd[4] = 0x02;		break;	case 230400:		cmd[4] = 0x01;		break;	case 460800:		cmd[4] = 0x00;		break;	case 921600:		cmd[4] = 0x20;		break;	case 2000000:		cmd[4] = 0x25;		break;	case 3000000:		cmd[4] = 0x27;		break;	case 4000000:		cmd[4] = 0x2B;		break;	default:		cmd[4] = 0x03;		u->speed = 57600;		fprintf(stderr, "Invalid speed requested, using %d bps instead\n", u->speed);		break;	}	/* Send initialization command */	if (write(fd, cmd, 5) != 5) {		perror("Failed to write init command");		return -1;	}	nanosleep(&tm, NULL);	return 0;}/*  * Digianswer specific initialization  */static int digi(int fd, struct uart_t *u, struct termios *ti){	struct timespec tm = {0, 50000};	char cmd[5];	/* DigiAnswer set baud rate command */	cmd[0] = HCI_COMMAND_PKT;	cmd[1] = 0x07;	cmd[2] = 0xfc;	cmd[3] = 0x01;	switch (u->speed) {	case 57600:		cmd[4] = 0x08;		break;	case 115200:		cmd[4] = 0x09;		break;	default:		cmd[4] = 0x09;		u->speed = 115200;		break;	}	/* Send initialization command */	if (write(fd, cmd, 5) != 5) {		perror("Failed to write init command");		return -1;	}	nanosleep(&tm, NULL);	return 0;}static int texas(int fd, struct uart_t *u, struct termios *ti){	struct timespec tm = {0, 50000};	char cmd[4];	unsigned char resp[100];		/* Response */	int n;	memset(resp,'\0', 100);	/* It is possible to get software version with manufacturer specific 	   HCI command HCI_VS_TI_Version_Number. But the only thing you get more	   is if this is point-to-point or point-to-multipoint module */	/* Get Manufacturer and LMP version */	cmd[0] = HCI_COMMAND_PKT;	cmd[1] = 0x01;	cmd[2] = 0x10;	cmd[3] = 0x00;	do {		n = write(fd, cmd, 4);		if (n < 0) {			perror("Failed to write init command (READ_LOCAL_VERSION_INFORMATION)");			return -1;		}		if (n < 4) {			fprintf(stderr, "Wanted to write 4 bytes, could only write %d. Stop\n", n);			return -1;		}		/* Read reply. */		if (read_hci_event(fd, resp, 100) < 0) {			perror("Failed to read init response (READ_LOCAL_VERSION_INFORMATION)");			return -1;		}		/* Wait for command complete event for our Opcode */	} while (resp[4] != cmd[1] && resp[5] != cmd[2]);	/* Verify manufacturer */	if ((resp[11] & 0xFF) != 0x0d)		fprintf(stderr,"WARNING : module's manufacturer is not Texas Instrument\n");	/* Print LMP version */	fprintf(stderr, "Texas module LMP version : 0x%02x\n", resp[10] & 0xFF);	/* Print LMP subversion */	fprintf(stderr, "Texas module LMP sub-version : 0x%02x%02x\n", resp[14] & 0xFF, resp[13] & 0xFF);	nanosleep(&tm, NULL);	return 0;}static int read_check(int fd, void *buf, int count){	int res;	do {		res = read(fd, buf, count);		if (res != -1) {			buf += res; 			count -= res;		}	} while (count && (errno == 0 || errno == EINTR));	if (count)		return -1;	return 0;}/* * BCSP specific initialization */int serial_fd;static void bcsp_tshy_sig_alarm(int sig){	static int retries=0;	unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};	int len;	if (retries < 10) {		retries++;		len = write(serial_fd, &bcsp_sync_pkt, 10);		alarm(1);		return;	}	tcflush(serial_fd, TCIOFLUSH);	fprintf(stderr, "BCSP initialization timed out\n");	exit(1);}static void bcsp_tconf_sig_alarm(int sig){	static int retries=0;	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};	int len;	if (retries < 10){		retries++;		len = write(serial_fd, &bcsp_conf_pkt, 10);		alarm(1);		return;	}	tcflush(serial_fd, TCIOFLUSH);	fprintf(stderr, "BCSP initialization timed out\n");	exit(1);}static int bcsp(int fd, struct uart_t *u, struct termios *ti){	unsigned char byte, bcsph[4], bcspp[4],		bcsp_sync_resp_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xac,0xaf,0xef,0xee,0xc0},		bcsp_conf_resp_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xde,0xad,0xd0,0xd0,0xc0},		bcspsync[4]     = {0xda, 0xdc, 0xed, 0xed},		bcspsyncresp[4] = {0xac,0xaf,0xef,0xee},		bcspconf[4]     = {0xad,0xef,0xac,0xed},		bcspconfresp[4] = {0xde,0xad,0xd0,0xd0};	struct sigaction sa;	int len;	if (set_speed(fd, ti, u->speed) < 0) {		perror("Can't set default baud rate");		return -1;	}	ti->c_cflag |= PARENB;	ti->c_cflag &= ~(PARODD);	if (tcsetattr(fd, TCSANOW, ti) < 0) {		perror("Can't set port settings");		return -1;	}	alarm(0);	serial_fd = fd;	memset(&sa, 0, sizeof(sa));	sa.sa_flags = SA_NOCLDSTOP;	sa.sa_handler = bcsp_tshy_sig_alarm;	sigaction(SIGALRM, &sa, NULL);	/* State = shy */	bcsp_tshy_sig_alarm(0);	while (1) {		do {			if (read_check(fd, &byte, 1) == -1){				perror("Failed to read");				return -1;			}		} while (byte != 0xC0);		do {			if ( read_check(fd, &bcsph[0], 1) == -1){				perror("Failed to read");				return -1;			}		} while (bcsph[0] == 0xC0);		if ( read_check(fd, &bcsph[1], 3) == -1){			perror("Failed to read");			return -1;		}		if (((bcsph[0] + bcsph[1] + bcsph[2]) & 0xFF) != (unsigned char)~bcsph[3])			continue;		if (bcsph[1] != 0x41 || bcsph[2] != 0x00)			continue;		if (read_check(fd, &bcspp, 4) == -1){			perror("Failed to read");			return -1;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩高清一区二区三区| 国产69精品一区二区亚洲孕妇| 久久先锋影音av鲁色资源网| 777午夜精品免费视频| 99精品一区二区| 91麻豆成人久久精品二区三区| 成人午夜伦理影院| caoporm超碰国产精品| 成人动漫中文字幕| 99精品热视频| 9i在线看片成人免费| 99久久精品免费看| 91蜜桃在线免费视频| 91成人在线精品| 欧美手机在线视频| 91精品麻豆日日躁夜夜躁| 56国语精品自产拍在线观看| 欧美va日韩va| 国产日韩v精品一区二区| 久久久久国产免费免费| www久久精品| 亚洲天堂成人在线观看| 亚洲欧美日韩国产手机在线 | 麻豆精品国产传媒mv男同 | 国产女同互慰高潮91漫画| 国产日韩欧美精品一区| 亚洲免费观看高清完整版在线| 亚洲国产cao| 国产麻豆视频一区| 91亚洲精品久久久蜜桃网站| 欧美精品粉嫩高潮一区二区| 久久综合资源网| 亚洲女同ⅹxx女同tv| 日本三级亚洲精品| 国产精品77777| 欧洲国产伦久久久久久久| 亚洲精品一区二区三区福利 | 欧美精品日日鲁夜夜添| 久久精品一区八戒影视| 亚洲一区中文在线| 韩日欧美一区二区三区| 91香蕉视频黄| 久久一二三国产| 亚洲黄色av一区| 国产精品一区二区在线观看不卡| 在线观看日韩精品| 久久精品一级爱片| 日本欧美一区二区三区| 99久久伊人精品| 26uuu色噜噜精品一区| 亚洲午夜一区二区三区| 成人动漫一区二区| 精品电影一区二区三区| 亚洲成人av一区| 一本色道久久综合精品竹菊| 26uuu亚洲| 美女视频免费一区| 欧美日韩精品一区二区在线播放| 中文一区在线播放| 麻豆久久一区二区| 欧美日韩你懂的| 一区二区三区欧美| av亚洲产国偷v产偷v自拍| 久久综合九色欧美综合狠狠 | 91在线码无精品| 国产亚洲欧美激情| 国产在线看一区| 日韩一区二区视频在线观看| 欧美国产精品专区| 国产精品一区二区黑丝| 精品国产乱码久久久久久久久| 午夜久久久久久| 欧美专区亚洲专区| 依依成人综合视频| 91丝袜美腿高跟国产极品老师| 欧美激情一区二区三区| 国产.欧美.日韩| 国产清纯白嫩初高生在线观看91| 国内外精品视频| 久久综合精品国产一区二区三区 | 色悠久久久久综合欧美99| 国产欧美日本一区视频| 国产成人综合在线观看| 国产日韩欧美在线一区| 国产成人精品午夜视频免费 | 91视频免费看| 国产精品视频一二三区 | 亚洲欧美色一区| 欧美体内she精视频| 一区二区三区在线播放| 欧美日韩一区二区电影| 日韩精品欧美成人高清一区二区| 日韩一区二区精品| 国产成a人亚洲精品| 亚洲欧美日韩国产一区二区三区 | 日韩电影在线观看一区| 欧美一区二区在线视频| 国产在线精品一区二区不卡了| 国产亚洲自拍一区| 在线免费观看日本一区| 丝袜美腿亚洲综合| 久久影院电视剧免费观看| www.亚洲人| 日本三级韩国三级欧美三级| 久久久久久久久久久久久夜| 成人福利在线看| 夜夜嗨av一区二区三区中文字幕| 毛片一区二区三区| 亚洲欧洲三级电影| 欧美日韩国产一级二级| 日韩成人一级片| 欧美日韩视频一区二区| 伦理电影国产精品| 久久久噜噜噜久久中文字幕色伊伊| 风间由美一区二区av101| 日韩一区中文字幕| 成人久久18免费网站麻豆| 亚洲国产精品久久久久婷婷884| 欧美人与禽zozo性伦| 久久66热偷产精品| 国产精品网站在线观看| 欧美日韩视频第一区| 成人黄色在线视频| 天天综合色天天| 久久久蜜桃精品| 欧美在线观看视频一区二区三区| 日韩av高清在线观看| 久久久久久97三级| 欧美三级电影在线观看| 国产精品一区久久久久| 亚洲福利国产精品| 国产午夜三级一区二区三| 色综合色综合色综合 | 亚洲成人1区2区| 欧美激情综合五月色丁香| 欧美午夜精品免费| 国产成人在线观看免费网站| 亚洲国产精品久久人人爱| 久久免费国产精品| 欧美xfplay| 欧美影片第一页| 国产成a人亚洲精品| 日韩电影网1区2区| 国产精品高潮久久久久无| 欧美精品一区二区蜜臀亚洲| 在线观看www91| 国产成人av电影在线观看| 日韩精品一二区| 亚洲综合激情另类小说区| 久久青草欧美一区二区三区| 精品少妇一区二区三区| 欧美三级在线播放| 91美女视频网站| 国产一区二区三区av电影| 亚洲超丰满肉感bbw| 日韩电影在线观看电影| 亚洲自拍与偷拍| 综合色中文字幕| 欧美激情资源网| 中文字幕免费一区| 中文字幕第一区| 久久久久国产免费免费| 精品国产髙清在线看国产毛片| 欧美日韩免费高清一区色橹橹| 色综合久久综合中文综合网| a级高清视频欧美日韩| 高清shemale亚洲人妖| 麻豆精品在线播放| 久久国产精品露脸对白| 视频一区欧美日韩| 亚洲精品日韩综合观看成人91| 中文字幕不卡三区| 久久久久国产精品人| 久久精品网站免费观看| 久久久精品2019中文字幕之3| 2022国产精品视频| 中文字幕亚洲区| 亚洲精品v日韩精品| 亚洲激情图片qvod| 亚洲一区二区三区在线播放| 亚洲欧洲一区二区在线播放| 亚洲bt欧美bt精品| 日韩激情一区二区| 激情综合色综合久久综合| 国产在线一区二区| 成人黄动漫网站免费app| 99免费精品在线观看| 91高清视频在线| 在线播放一区二区三区| 欧美视频完全免费看| 精品国产a毛片| 欧美国产欧美综合| 一区二区三区加勒比av| 奇米888四色在线精品| www.亚洲免费av| 欧美精品久久天天躁| 26uuu色噜噜精品一区二区| 中文字幕在线播放不卡一区| 日韩av电影免费观看高清完整版| 国产一区 二区|