参考链接: http://www.ti.com/lit/ds/swrs121e/swrs121e.pdf
参考链接: https://whycan.cn/t_637.html
修改 hciattach.c
在 printf("Device setup complete\n"); 后添加:
close(n);
return 0;
删除:
if (ioctl(fd, HCIUARTSETPROTO, u->proto) < 0) {
perror("Can't set device");
return -1;
}
删除:
/* Restore TTY line discipline */
ld = N_TTY;
if (ioctl(n, TIOCSETD, &ld) < 0) {
perror("Can't restore line discipline");
exit(1);
}
让rtl8723bs 更新固件, 运行命令:
sudo ./rtk_hciattach -n -s 115200 /dev/ttyUSB1 rtk_h5
输出log:
xxx@ubuntu:/opt/ap6210$ sudo ./brcm_patchram_plus -d --patchram bcm20710a1.hcd --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyUSB1
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5
Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8
Realtek Bluetooth :Get SYNC Resp Pkt
Realtek Bluetooth :Get SYNC pkt-active mode
Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG pkt-active mode
Realtek Bluetooth :Get CONFG resp pkt-active mode
Realtek Bluetooth :H5 init finished
Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :receive hci command complete event with command:1001
Realtek Bluetooth :Read RTK LMP version with Status:0
Realtek Bluetooth :gLmpVersion = 0x8723
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :receive hci command complete event with command:fc6d
Realtek Bluetooth :Read RTK rom version with Status:0
Realtek Bluetooth :rtk_hw_cfg.eversion = 1
Realtek Bluetooth :rtk_get_fw_project_id: opcode 0, len 1, data 1
Realtek Bluetooth :fw_ver 0x1e3ee40e, patch_num 2
Realtek Bluetooth :patch length is 0x5e90
Realtek Bluetooth :start offset is 0x4f00
Realtek Bluetooth :fw: exists, config file: exists
Realtek Bluetooth :baudrate in change speed command: 0x2 0x80 0x92 0x4
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :receive hci command complete event with command:fc17
Realtek Bluetooth :Change BD Rate with status:0
Realtek Bluetooth :final_speed 1500000
Realtek Bluetooth :hw flow control enable
Realtek Bluetooth :iEndIndex:96 iLastPacketLen:71 iAdditionpkt:4
Realtek Bluetooth :hci_download_patch tx_index:0 rx_index: -1
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 0
Realtek Bluetooth :hci_download_patch tx_index:1 rx_index: 0
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 1
Realtek Bluetooth :hci_download_patch tx_index:2 rx_index: 1
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 2
Realtek Bluetooth :hci_download_patch tx_index:3 rx_index: 2
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 3
Realtek Bluetooth :hci_download_patch tx_index:4 rx_index: 3
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 4
Realtek Bluetooth :hci_download_patch tx_index:5 rx_index: 4
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 5
Realtek Bluetooth :hci_download_patch tx_index:6 rx_index: 5
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 6
Realtek Bluetooth :hci_download_patch tx_index:7 rx_index: 6
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 7
Realtek Bluetooth :hci_download_patch tx_index:8 rx_index: 7
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 8
Realtek Bluetooth :hci_download_patch tx_index:9 rx_index: 8
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 9
Realtek Bluetooth :hci_download_patch tx_index:10 rx_index: 9
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 10
Realtek Bluetooth :hci_download_patch tx_index:11 rx_index: 10
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 11
Realtek Bluetooth :hci_download_patch tx_index:12 rx_index: 11
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 12
Realtek Bluetooth :hci_download_patch tx_index:13 rx_index: 12
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 13
Realtek Bluetooth :hci_download_patch tx_index:14 rx_index: 13
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 14
Realtek Bluetooth :hci_download_patch tx_index:15 rx_index: 14
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 15
Realtek Bluetooth :hci_download_patch tx_index:16 rx_index: 15
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 16
Realtek Bluetooth :hci_download_patch tx_index:17 rx_index: 16
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 17
Realtek Bluetooth :hci_download_patch tx_index:18 rx_index: 17
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 18
Realtek Bluetooth :hci_download_patch tx_index:19 rx_index: 18
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 19
Realtek Bluetooth :hci_download_patch tx_index:20 rx_index: 19
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 20
Realtek Bluetooth :hci_download_patch tx_index:21 rx_index: 20
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 21
Realtek Bluetooth :hci_download_patch tx_index:22 rx_index: 21
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 22
Realtek Bluetooth :hci_download_patch tx_index:23 rx_index: 22
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 23
Realtek Bluetooth :hci_download_patch tx_index:24 rx_index: 23
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 24
Realtek Bluetooth :hci_download_patch tx_index:25 rx_index: 24
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 25
Realtek Bluetooth :hci_download_patch tx_index:26 rx_index: 25
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 26
Realtek Bluetooth :hci_download_patch tx_index:27 rx_index: 26
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 27
Realtek Bluetooth :hci_download_patch tx_index:28 rx_index: 27
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 28
Realtek Bluetooth :hci_download_patch tx_index:29 rx_index: 28
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 29
Realtek Bluetooth :hci_download_patch tx_index:30 rx_index: 29
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 30
Realtek Bluetooth :hci_download_patch tx_index:31 rx_index: 30
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 31
Realtek Bluetooth :hci_download_patch tx_index:32 rx_index: 31
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 32
Realtek Bluetooth :hci_download_patch tx_index:33 rx_index: 32
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 33
Realtek Bluetooth :hci_download_patch tx_index:34 rx_index: 33
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 34
Realtek Bluetooth :hci_download_patch tx_index:35 rx_index: 34
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 35
Realtek Bluetooth :hci_download_patch tx_index:36 rx_index: 35
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 36
Realtek Bluetooth :hci_download_patch tx_index:37 rx_index: 36
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 37
Realtek Bluetooth :hci_download_patch tx_index:38 rx_index: 37
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 38
Realtek Bluetooth :hci_download_patch tx_index:39 rx_index: 38
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 39
Realtek Bluetooth :hci_download_patch tx_index:40 rx_index: 39
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 40
Realtek Bluetooth :hci_download_patch tx_index:41 rx_index: 40
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 41
Realtek Bluetooth :hci_download_patch tx_index:42 rx_index: 41
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 42
Realtek Bluetooth :hci_download_patch tx_index:43 rx_index: 42
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 43
Realtek Bluetooth :hci_download_patch tx_index:44 rx_index: 43
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 44
Realtek Bluetooth :hci_download_patch tx_index:45 rx_index: 44
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 45
Realtek Bluetooth :hci_download_patch tx_index:46 rx_index: 45
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 46
Realtek Bluetooth :hci_download_patch tx_index:47 rx_index: 46
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 47
Realtek Bluetooth :hci_download_patch tx_index:48 rx_index: 47
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 48
Realtek Bluetooth :hci_download_patch tx_index:49 rx_index: 48
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 49
Realtek Bluetooth :hci_download_patch tx_index:50 rx_index: 49
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 50
Realtek Bluetooth :hci_download_patch tx_index:51 rx_index: 50
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 51
Realtek Bluetooth :hci_download_patch tx_index:52 rx_index: 51
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 52
Realtek Bluetooth :hci_download_patch tx_index:53 rx_index: 52
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 53
Realtek Bluetooth :hci_download_patch tx_index:54 rx_index: 53
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 54
Realtek Bluetooth :hci_download_patch tx_index:55 rx_index: 54
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 55
Realtek Bluetooth :hci_download_patch tx_index:56 rx_index: 55
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 56
Realtek Bluetooth :hci_download_patch tx_index:57 rx_index: 56
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 57
Realtek Bluetooth :hci_download_patch tx_index:58 rx_index: 57
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 58
Realtek Bluetooth :hci_download_patch tx_index:59 rx_index: 58
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 59
Realtek Bluetooth :hci_download_patch tx_index:60 rx_index: 59
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 60
Realtek Bluetooth :hci_download_patch tx_index:61 rx_index: 60
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 61
Realtek Bluetooth :hci_download_patch tx_index:62 rx_index: 61
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 62
Realtek Bluetooth :hci_download_patch tx_index:63 rx_index: 62
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 63
Realtek Bluetooth :hci_download_patch tx_index:64 rx_index: 63
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 64
Realtek Bluetooth :hci_download_patch tx_index:65 rx_index: 64
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 65
Realtek Bluetooth :hci_download_patch tx_index:66 rx_index: 65
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 66
Realtek Bluetooth :hci_download_patch tx_index:67 rx_index: 66
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 67
Realtek Bluetooth :hci_download_patch tx_index:68 rx_index: 67
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 68
Realtek Bluetooth :hci_download_patch tx_index:69 rx_index: 68
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 69
Realtek Bluetooth :hci_download_patch tx_index:70 rx_index: 69
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 70
Realtek Bluetooth :hci_download_patch tx_index:71 rx_index: 70
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 71
Realtek Bluetooth :hci_download_patch tx_index:72 rx_index: 71
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 72
Realtek Bluetooth :hci_download_patch tx_index:73 rx_index: 72
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 73
Realtek Bluetooth :hci_download_patch tx_index:74 rx_index: 73
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 74
Realtek Bluetooth :hci_download_patch tx_index:75 rx_index: 74
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 75
Realtek Bluetooth :hci_download_patch tx_index:76 rx_index: 75
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 76
Realtek Bluetooth :hci_download_patch tx_index:77 rx_index: 76
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 77
Realtek Bluetooth :hci_download_patch tx_index:78 rx_index: 77
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 78
Realtek Bluetooth :hci_download_patch tx_index:79 rx_index: 78
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 79
Realtek Bluetooth :hci_download_patch tx_index:80 rx_index: 79
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 80
Realtek Bluetooth :hci_download_patch tx_index:81 rx_index: 80
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 81
Realtek Bluetooth :hci_download_patch tx_index:82 rx_index: 81
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 82
Realtek Bluetooth :hci_download_patch tx_index:83 rx_index: 82
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 83
Realtek Bluetooth :hci_download_patch tx_index:84 rx_index: 83
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 84
Realtek Bluetooth :hci_download_patch tx_index:85 rx_index: 84
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 85
Realtek Bluetooth :hci_download_patch tx_index:86 rx_index: 85
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 86
Realtek Bluetooth :hci_download_patch tx_index:87 rx_index: 86
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 87
Realtek Bluetooth :hci_download_patch tx_index:88 rx_index: 87
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 88
Realtek Bluetooth :hci_download_patch tx_index:89 rx_index: 88
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 89
Realtek Bluetooth :hci_download_patch tx_index:90 rx_index: 89
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 90
Realtek Bluetooth :hci_download_patch tx_index:91 rx_index: 90
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 91
Realtek Bluetooth :hci_download_patch tx_index:92 rx_index: 91
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 92
Realtek Bluetooth :hci_download_patch tx_index:93 rx_index: 92
Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 93
Realtek Bluetooth :hci_download_patch tx_index:94 rx_index: 93
Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 94
Realtek Bluetooth :hci_download_patch tx_index:95 rx_index: 94
Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 95
Realtek Bluetooth :hci_download_patch tx_index:96 rx_index: 95
Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 96
Realtek Bluetooth :hci_download_patch tx_index:97 rx_index: 96
Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 97
Realtek Bluetooth :hci_download_patch tx_index:98 rx_index: 97
Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 98
Realtek Bluetooth :hci_download_patch tx_index:99 rx_index: 98
Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 99
Realtek Bluetooth :Send FW last command
Realtek Bluetooth :hci_download_patch tx_index:100 rx_index: 99
Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 100
Realtek Bluetooth :Init Process finished
Realtek Bluetooth post process
Device setup complete
xxx@ubuntu:/opt/ap6210$
搜索附近的蓝牙设备:
xxx@ubuntu:/opt/btstack/port/posix-h5$ sudo ./gap_inquiry
Packet Log: /tmp/hci_dump.pklg
[2018-05-05 11:43:31.831] LOG -- hci.c.2800: hci_power_control: 1, current mode 0
[2018-05-05 11:43:33.537] LOG -- btstack_uart_block_posix.c.177: h4_set_baudrate 115200
[2018-05-05 11:43:33.638] LOG -- hci_transport_h5.c.830: UART driver does not provide compatible sleep mode
[2018-05-05 11:43:33.638] LOG -- hci_transport_h5.c.720: resend timeout for 115200 baud: 405 ms
[2018-05-05 11:43:33.638] LOG -- hci.c.3859: BTSTACK_EVENT_STATE 1
[2018-05-05 11:43:33.638] EVT <= 60 01 01
离线
https://whycan.cn/files/members/3/QQ20180507134225.png
gatttools 用 AP6201B 和 RTL8723BS 永远都是 connect error: Device or resource busy (16)
RRRR@ubuntu:/disk5$ sudo gatttool -b C8:0F:10:34:B7:CA -I
[ ][C8:0F:10:34:B7:CA][LE]> connect
[CON][C8:0F:10:34:B7:CA][LE]> primary
[CON][C8:0F:10:34:B7:CA][LE]>
attr handle: 0x0001, end grp handle: 0x0009 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0039 uuid: 0000fee0-0000-1000-8000-00805f9b34fb
attr handle: 0x003a, end grp handle: 0x0048 uuid: 0000fee1-0000-1000-8000-00805f9b34fb
attr handle: 0x0049, end grp handle: 0x004e uuid: 0000180d-0000-1000-8000-00805f9b34fb
attr handle: 0x004f, end grp handle: 0x0051 uuid: 00001802-0000-1000-8000-00805f9b34fb
[CON][C8:0F:10:34:B7:CA][LE]> characteristics
[CON][C8:0F:10:34:B7:CA][LE]>
handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x0a, char value handle: 0x0007, uuid: 00002a02-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x02, char value handle: 0x0009, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x22, char value handle: 0x000e, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0011, char properties: 0x02, char value handle: 0x0012, uuid: 0000ff01-0000-1000-8000-00805f9b34fb
handle: 0x0013, char properties: 0x0a, char value handle: 0x0014, uuid: 0000ff02-0000-1000-8000-00805f9b34fb
handle: 0x0015, char properties: 0x12, char value handle: 0x0016, uuid: 0000ff03-0000-1000-8000-00805f9b34fb
handle: 0x0018, char properties: 0x0a, char value handle: 0x0019, uuid: 0000ff04-0000-1000-8000-00805f9b34fb
handle: 0x001a, char properties: 0x08, char value handle: 0x001b, uuid: 0000ff05-0000-1000-8000-00805f9b34fb
handle: 0x001c, char properties: 0x12, char value handle: 0x001d, uuid: 0000ff06-0000-1000-8000-00805f9b34fb
handle: 0x001f, char properties: 0x12, char value handle: 0x0020, uuid: 0000ff07-0000-1000-8000-00805f9b34fb
handle: 0x0022, char properties: 0x04, char value handle: 0x0023, uuid: 0000ff08-0000-1000-8000-00805f9b34fb
handle: 0x0024, char properties: 0x1a, char value handle: 0x0025, uuid: 0000ff09-0000-1000-8000-00805f9b34fb
handle: 0x0027, char properties: 0x0a, char value handle: 0x0028, uuid: 0000ff0a-0000-1000-8000-00805f9b34fb
handle: 0x0029, char properties: 0x0a, char value handle: 0x002a, uuid: 0000ff0b-0000-1000-8000-00805f9b34fb
handle: 0x002b, char properties: 0x12, char value handle: 0x002c, uuid: 0000ff0c-0000-1000-8000-00805f9b34fb
handle: 0x002e, char properties: 0x0a, char value handle: 0x002f, uuid: 0000ff0d-0000-1000-8000-00805f9b34fb
handle: 0x0030, char properties: 0x1a, char value handle: 0x0031, uuid: 0000ff0e-0000-1000-8000-00805f9b34fb
handle: 0x0033, char properties: 0x0a, char value handle: 0x0034, uuid: 0000ff0f-0000-1000-8000-00805f9b34fb
handle: 0x0035, char properties: 0x10, char value handle: 0x0036, uuid: 0000ff10-0000-1000-8000-00805f9b34fb
handle: 0x0038, char properties: 0x02, char value handle: 0x0039, uuid: 0000fec9-0000-1000-8000-00805f9b34fb
handle: 0x003b, char properties: 0x08, char value handle: 0x003c, uuid: 0000fedd-0000-1000-8000-00805f9b34fb
handle: 0x003d, char properties: 0x02, char value handle: 0x003e, uuid: 0000fede-0000-1000-8000-00805f9b34fb
handle: 0x003f, char properties: 0x02, char value handle: 0x0040, uuid: 0000fedf-0000-1000-8000-00805f9b34fb
handle: 0x0041, char properties: 0x08, char value handle: 0x0042, uuid: 0000fed0-0000-1000-8000-00805f9b34fb
handle: 0x0043, char properties: 0x08, char value handle: 0x0044, uuid: 0000fed1-0000-1000-8000-00805f9b34fb
handle: 0x0045, char properties: 0x02, char value handle: 0x0046, uuid: 0000fed2-0000-1000-8000-00805f9b34fb
handle: 0x0047, char properties: 0x08, char value handle: 0x0048, uuid: 0000fed3-0000-1000-8000-00805f9b34fb
handle: 0x004a, char properties: 0x10, char value handle: 0x004b, uuid: 00002a37-0000-1000-8000-00805f9b34fb
handle: 0x004d, char properties: 0x0a, char value handle: 0x004e, uuid: 00002a39-0000-1000-8000-00805f9b34fb
handle: 0x0050, char properties: 0x04, char value handle: 0x0051, uuid: 00002a06-0000-1000-8000-00805f9b34fb
[ ][C8:0F:10:34:B7:CA][LE]>
问题已经解决,
原来是手环被 小米运动 app占用了,
把手机蓝牙禁用问题就解决了。
离线
终于找到了设置波特率到 1.5Mbps的地方, 开始我以为和AP6210B那个套路一样,在命令行参数设定,后来发现根本不是。
跟踪 hciattach_rtk.c rtk_parse_config_file() 函数,
打开这个文件 /lib/firmware/rtl_bt/rtlbt_config
改成 14 C0 52 02 即为 115200 波特率,
即对应代码中的
{0x0252C014, 115200}
用逻辑分析仪观察, 全程 115200 了.
离线
先初始化RTL8723BS:
sudo ./rtk_hciattach -n -s 115200 /dev/ttyUSB1 rtk_h5
运行btstack测试程序:
RRRR@ubuntu:/opt/btstack/port/posix-h5$ sudo ./gap_inquiry -u /dev/ttyUSB1
Packet Log: /tmp/hci_dump.pklg
[2018-05-08 10:24:36.828] LOG -- hci.c.2800: hci_power_control: 1, current mode 0
[2018-05-08 10:24:36.934] LOG -- btstack_uart_block_posix.c.177: h4_set_baudrate 115200
[2018-05-08 10:24:37.035] LOG -- hci_transport_h5.c.830: UART driver does not provide compatible sleep mode
[2018-05-08 10:24:37.035] LOG -- hci_transport_h5.c.720: resend timeout for 115200 baud: 405 ms
[2018-05-08 10:24:37.035] LOG -- hci.c.3859: BTSTACK_EVENT_STATE 1
[2018-05-08 10:24:37.035] EVT <= 60 01 01
还真是一点反应都没有,
然后进入看逻辑分析仪:
立刻想到了 打开 串口的姿势不正确.
离线
找到这个页面: https://bluekitchen-gmbh.com/btstack/chipsets/
BCSP
The predecessor of H5. The main difference to H5 is that Even Parity is used for BCSP. To use BCSP with BTstack, you use the H5 transport and can call hci_transport_h5_enable_bcsp_mode
看能不能发现一些端倪。
离线
离线
插入问个话,RTL8723BS模块,用V3S的BSP内核里附带的驱动,wifi部分工作正常,用 ./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5,完全没有收到回应。看引脚上的发给模块的UART TX正常,RX始终高电平。检查了模块的BT RESET引脚为高电平。
这个问题的答案应该在 16 楼
离线
晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:
cat avdtp_sink.wav RIFF$WAVEfmt D▒▒ data
.
这个是 wav 文件的头吧, 估计是一个bug.
离线
晕哥 说:WM_CH 说:晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:
cat avdtp_sink.wav RIFF$WAVEfmt D▒▒ data
.
这个是 wav 文件的头吧, 估计是一个bug.
果然,WAV文件的头就是44字节,,,只是后边的PCM数据都没写入文件,是不是我操作不对哦
是不是没收到数据, 本来程序要写一个完成的wav 文件的,是不是因为没有收到数据导致只有头了?
或者 a2dp编码转 wav编码出问题了?
离线