参考
https://lowreal.net/2016/09/08/1
https://gist.github.com/mamemomonga/b63d8dedf36604218aa823999bb42506
環境
使ったデバイス
PLANEX Bluetooth USBアダプター Ver.4.0+EDR/LE(省エネ設計)対応 BT-Micro4
hid2hci
CentOS7
hid2hciをインストールしておく
yum install hid2hci
debian系
$ sudo apt install libglib2.0-dev \ libdbus-1-dev libudev-dev libical-dev \ libreadline-dev libbluetooth-dev $ wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.48.tar.xz $ tar Jxf bluez-5.48.tar.xz $ cd bluez-5.48 $ ./configure $ make tools/hid2hci
状態確認
lsusb
lsusb .... Bus 003 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) ...
hciconfig
hciconfig -a
でデイバスの情報を確認。もし、UP RUNNING になっていない(DOWN)場合は
hciconfig hcix up
でデバイスを起動させておく。
モード確認
sudo bccmd -d xx:xx:xx:xx:xx:xx psget bootmode Initial device bootmode: 0x0000 (0)
HCIの場合は 0
HID Proxyを有効にする
アドレスを確認する
sudo bccmd -d xx:xx:xx:xx:xx:xx psread -s 0 | grep 'INITIAL_BOOTMODE' -A 1 // PSKEY_INITIAL_BOOTMODE &03cd = 0000
HID Proxyに切り替える
sudo bccmd -d xx:xx:xx:xx:xx:xx psset -s 0 0x03cd 0x0002
0x03cd は上で確認したアドレスを指定する
切替後の状態確認
一度抜き差ししてから、
lsusb ... Bus 003 Device 005: ID 0a12:100b Cambridge Silicon Radio, Ltd ...
HCIの文字が消えている
HCIモードに戻す
hid2hci
sudo tools/hid2hci --method=csr2 \
--devpath=$( udevadm trigger --verbose --subsystem-match=usb \
--attr-match=idVendor=0a12 --attr-match=idProduct=100b \
| cut -d '/' -f 3- )
もし、devpathが取得できない場合は、
udevadm monitor
で監視しながら、bluetoothレシーバを抜き差しすると
... UDEV [3400.578971] add /devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.1 (usb) ...
的なログが見れる。
/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.1
がdevpathなので、それをそのまま指定しても良い。
sudo tools/hid2hci --method=csr2 --devpath=/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.1
bccmdでモード設定
sudo bccmd -d xx:xx:xx:xx:xx:xx psset -s 0 0x03cd 0x0000 sudo bccmd -d xx:xx:xx:xx:xx:xx psget bootmode Initial device bootmode: 0x0000 (0)
RaspberryPI
1 exit 2 cd 3 cd temp/ 4 cd bluez-4.99/ 5 ls 6 grep csr_open_hci 7 grep -R csr_open_hci 8 grep -R csr_open_bcsp 9 grep -R csr_open_h4 10 grep -R csr_write_3wire 11 grep -R csr_close_bcsp 12 grep -R ubcsp_receive_packet 13 lsusb 14 hciconfig -a 15 cd 16 ls 17 mkdir temp 18 cd temp/ 19 ls 20 apt 21 sudo apt update 22 sudo apt list | grep -i hid 23 sudo apt list | grep -i hid2hci 24 wget http://www.kernel.org/pub/bluetooth/bluez-5.48.tar.xz 25 wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.48.tar.xz 26 sudo apt install libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev libbluetooth-dev 27 ls 28 tar Jxf bluez-5.48.tar.xz 29 cd bluez-5.48/ 30 ls 31 ./configure 32 apt list | grep -i udev 33 less /etc/os-release 34 top 35 ./configure 36 cd .. 37 wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.84.tar.xz 38 ls 39 tar jXvf bluez-5.84.tar.xz 40 tar jvf bluez-5.84.tar.xz 41 tar jxvf bluez-5.84.tar.xz 42 tar Jxvf bluez-5.84.tar.xz 43 cd bluez-5.84/ 44 ./configure 45 sudo install libudev-dev 46 sudo apt install libudev-dev 47 ls /usr/include/libudev.h 48 pkg-config --cflags --libs libudev 49 ./configure --with-udevdir=/usr/lib/udev 50 cd .. 51 ls 52 cd bluez-5.48/ 53 ./configure --with-udevdir=/usr/lib/udev 54 sudo apt install systemd-dev systemd 55 ./configure --with-udevdir=/usr/lib/udev 56 make tools/hid2hci 57 ls 58 apt list | grep -i bccmd 59 ls 60 find ./ bccmd 61 find ./ -name bccmd 62 cd .. 63 wget https://www.kernel.org/pub/linux/bluetooth/bluez-4.99.tar.xz 64 ls 65 tar Jxvf bluez-4.99.tar.xz 66 cd bluez-4.99/ 67 ./configre 68 ./configure 69 cd .. 70 ls 71 find ./ -name bccmd* 72 cd ./bluez-5.48/ 73 ls 74 cd tools/ 75 gcc -o bccmd bccmd.c -lbluetooth 76 gcc -o bccmd bccmd.c 77 gcc -o bccmd bccmd.c -lbluetooth 78 find ./ -name bluetooth.h 79 suto apt install libbluetooth-ev 80 sudo apt install libbluetooth-ev 81 sudo apt install libbluetooth-dev 82 find ./ -name bluetooth.h 83 find / -name bluetooth.h 84 find / -name bluetooth.h 2> /dev/null 85 cd .. 86 ls 87 gcc -o bccmd bccmd.c -lbluetooth 88 gcc -o tools/bccmd tools/bccmd.c -lbluetooth 89 find ./ -name bluetooth.h 2> /dev/null 90 gcc -o tools/bccmd tools/bccmd.c -L ./ -lbluetooth 91 cd tools/ 92 gcc -o bccmd bccmd.c -lbluetooth 93 gcc -o bccmd bccmd.c -I ../ -lbluetooth 94 find / -name bluetooth.h 2> /dev/null 95 gcc -o bccmd bccmd.c -I /usr/include/bluetooth/ -lbluetooth 96 gcc -o bccmd bccmd.c -I ../ -lbluetooth 97 cd .. 98 find ./ -name bccmd* 99 cd bluez-4.99/ 100 ls 101 cd tools/ 102 gcc -o bccmd bccmd.c -lbluetooth 103 find ../ -name csr.c 104 gcc -o bccmd bccmd.c ../tools/csr.c -lbluetooth 105 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c -lbluetooth 106 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c -lbluetooth 107 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c -lbluetooth 108 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c -lbluetooth 109 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c -I ../ -lbluetooth 110 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c ../tools/ubcsp.c ../ -lbluetooth 111 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c ../tools/ubcsp.c -lbluetooth 112 ls 113 lsusb 114 hciconfig -a 115 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psget bootmode 116 hciconfig -a 117 sudo ./bccmd 00:1B:DC:F3:76:D4 psread -s 0 | grep 'INITIAL_BOOTMODE' -A 1 118 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psread -s 0 | grep 'INITIAL_BOOTMODE' -A 1 119 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 120 lsusb 121 ./bccmd -d 00:1B:DC:F3:76:D4 psget bootmode 122 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psget bootmode 123 ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0000 124 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 125 udevadm monitor 126 ls 127 cd .. 128 ls 129 find ./ -name hid2hci 130 make install 131 ls 132 make 133 ls 134 ./configure 135 cd .. 136 ls 137 cd .. 138 ls 139 cd temp/ 140 ls 141 cd bluez-5.48/ 142 ls 143 cd tools/ 144 ls 145 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c ../tools/ubcsp.c -lbluetooth 146 gcc -o bccmd bccmd.c ../tools/csr.c ../tools/csr_hci.c ../tools/csr_h4.c ../tools/csr_3wire.c ../tools/csr_bcsp.c ../tools/ubcsp.c -I../ -lbluetooth 147 ls 148 gcc -o bccmd bccmd.c csr.c csr_hci.c csr_h4.c csr_3wire.c csr_bcsp.c ubcsp.c -I../ -lbluetooth 149 gcc -o bccmd bccmd.c csr.c csr_hci.c csr_h4.c csr_3wire.c csr_bcsp.c ubcsp.c -lbluetooth 150 gcc -o bccmd bccmd.c csr.c csr_hci.c csr_h4.c csr_3wire.c csr_bcsp.c ubcsp.c -I../ -lbluetooth 151 grep csr_open_usb 152 grep -R ./ csr_open_usb 153 grep -R csr_open_usb ./ 154 gcc -o bccmd csr_usb.c bccmd.c csr.c csr_hci.c csr_h4.c csr_3wire.c csr_bcsp.c ubcsp.c -I../ -lbluetooth 155 ls 156 ./hid2hci --method=csr2 --devpath=$( udevadm trigger --vervose --subsystem-match=usb --attr-match=idVender=0a12 --attr-match=idProduct=100b | cut -d '/' -f 3-) 157 ./hid2hci --method=csr2 --devpath=$( udevadm trigger --verbose --subsystem-match=usb --attr-match=idVender=0a12 --attr-match=idProduct=100b | cut -d '/' -f 3-) 158 ./hid2hci --method=csr2 159 ./hid2hci --method=csr2 --devpath=$( udevadm trigger --verbose --subsystem-match=usb --attr-match=idVendor=0a12 --attr-match=idProduct=100b | cut -d '/' -f 3-) 160 sudo ./hid2hci --method=csr2 --devpath=$( udevadm trigger --verbose --subsystem-match=usb --attr-match=idVendor=0a12 --attr-match=idProduct=100b | cut -d '/' -f 3-) 161 udevadm monitor 162 sudo ./hid2hci --method=csr2 --devpath=$( udevadm trigger --verbose --subsystem-match=usb --attr-match=idVendor=0a12 --attr-match=idProduct=100b | cut -d '/' -f 3-) 163 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 164 lsusb 165 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 166 lsusb 167 hciconfig -a 168 lsusb 169 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 170 hciconfig -a 171 hciconfig hci0 down 172 sudo hciconfig hci0 down 173 hciconfig -a 174 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 175 hciconfig -a 176 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 177 hciconfig -a 178 lsusb 179 hciconfig -a 180 lsusb 181 hciconfig -a 182 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 183 hciconfig -a 184 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 185 hciconfig -a 186 lsusb 187 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 188 lsusb 189 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 190 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 191 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0001 192 lsusb 193 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0001 194 lsusb 195 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psget bootmode 196 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 197 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psget bootmode 198 lsusb 199 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0003 200 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 201 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0003 202 lsusb 203 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 204 cd 205 cd temp/bluez-5.48/tools/ 206 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 207 hciconfig -a 208 hciconfig hci0 down 209 sudo hciconfig hci0 down 210 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 211 sudo ./bccmd -d 00:1B:DC:F3:76:D4 bslist 212 sudo ./bccmd -d 00:1B:DC:F3:76:D4 pslist 213 hciconfig -a 214 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 215 sudo ./bccmd -d 00:1B:DC:F3:76:D4 psset -s 0 0x03cd 0x0002 216 lsusb 217 sudo ./hid2hci --method=csr2 --devpath=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 218 hisotory 219 history
[カテゴリ: OS > Linux]
[通知用URL]
Tweet
最終更新時間:2025年10月19日 22時05分19秒