カーネルをつくるときに/usr/src/sys/amd64/confに以下の設定を追加してある。
VAIO type PでつかっているLogitech Bluetooth Mouse M555bと 仕事で使おうと購入したCoregaのBluetooth USBアダプタ CG-BT2USB02CB を用意して いじってみた。
FreeBSDハンドブック をみながらすすめたがよくわからず、先人の智恵を拝借: FreeBSD で BlueTooth マウスを利用する
マウスをつかうまでの手順まとめ:
マウスの電源を入れペアリングのボタン (connect) を長押ししてから hccontrol -n ubt0hci inquiry を実行するとデバイスのアドレスがとれる。
認証がどうなっているか見るにはhcsecdを-dオプションつきで起動する like this:
/etc/bluetooth/hostsにはこんな感じで追加:
bthidd.confは以下のようにして作成:
options NETGRAPH # netgraph(4) system options NETGRAPH_BLUETOOTH # ng_bluetooth(4) options NETGRAPH_BLUETOOTH_BT3C # ng_bt3c(4) options NETGRAPH_BLUETOOTH_HCI # ng_hci(4) options NETGRAPH_BLUETOOTH_L2CAP # ng_l2cap(4) options NETGRAPH_BLUETOOTH_SOCKET # ng_btsocket(4) options NETGRAPH_BLUETOOTH_UBT # ng_ubt(4) options NETGRAPH_BLUETOOTH_UBTBCMFW # ubtbcmfw(4)でもなかなか使い方がわからなかった。
VAIO type PでつかっているLogitech Bluetooth Mouse M555bと 仕事で使おうと購入したCoregaのBluetooth USBアダプタ CG-BT2USB02CB を用意して いじってみた。
FreeBSDハンドブック をみながらすすめたがよくわからず、先人の智恵を拝借: FreeBSD で BlueTooth マウスを利用する
マウスをつかうまでの手順まとめ:
- hccontrol -n ubt0hci inquiry でデバイスのアドレスをしらべる。
- l2ping -a xx:xx:xx:xx:xx:xx でつながることを確認する。
- /etc/bluetooth/hcsecd.confを書く。
- /etc/bluetooth/hostを書く。
- /etc/bluetooth/bthidd.confを書く。
- /etc/rc.d/hcsecd restart
- /etc/rc.d/bthidd restart
マウスの電源を入れペアリングのボタン (connect) を長押ししてから hccontrol -n ubt0hci inquiry を実行するとデバイスのアドレスがとれる。
% hccontrol -n ubt0hci inquiry Inquiry result, num_responses=1 Inquiry result #0 BD_ADDR: 00:07:61:f4:b4:85 Page Scan Rep. Mode: 0x1 Page Scan Period Mode: 0x2 Page Scan Mode: 00 Class: 00:25:80 Clock offset: 0x3426 Inquiry result, num_responses=1
% l2ping -a 00:07:61:f4:b4:85 0 bytes from 00:07:61:f4:b4:85 seq_no=0 time=843.105 ms result=0x6 0 bytes from 00:07:61:f4:b4:85 seq_no=1 time=268.955 ms result=0x6 0 bytes from 00:07:61:f4:b4:85 seq_no=2 time=279.770 ms result=0x6 0 bytes from 00:07:61:f4:b4:85 seq_no=3 time=292.892 ms result=0x6 ^C
認証がどうなっているか見るにはhcsecdを-dオプションつきで起動する like this:
# /usr/sbin/hcsecd -f /etc/bluetooth/hcsecd.conf -d hcsecd[2897]: Got Link_Key_Request event from 'ubt0hci', remote bdaddr 00:07:61:f4:b4:85 hcsecd[2897]: Found matching entry, remote bdaddr 00:07:61:f4:b4:85, name 'M555b', link key doesn't exist hcsecd[2897]: Sending Link_Key_Negative_Reply to 'ubt0hci' for remote bdaddr 00:07:61:f4:b4:85 hcsecd[2897]: Got PIN_Code_Request event from 'ubt0hci', remote bdaddr 00:07:61:f4:b4:85 hcsecd[2897]: Found matching entry, remote bdaddr 00:07:61:f4:b4:85, name 'M555b', PIN code exists hcsecd[2897]: Sending PIN_Code_Reply to 'ubt0hci' for remote bdaddr 00:07:61:f4:b4:85 hcsecd[2897]: Got Link_Key_Notification event from 'ubt0hci', remote bdaddr 00:07:61:f4:b4:85 hcsecd[2897]: Updating link key for the entry, remote bdaddr 00:07:61:f4:b4:85, name 'M555b', link key doesn'\ t existlink keyというは /var/db/hcsecd.keys に保存されるようだ。
/etc/bluetooth/hostsにはこんな感じで追加:
00:07:61:f4:b4:85 M555b
bthidd.confは以下のようにして作成:
# bthidcontrol -a M555b query >/etc/bluetooth/bthidd.conf device { bdaddr 00:07:61:f4:b4:85; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate true; battery_power true; normally_connectable false; hid_descriptor { 0x05 0x01 0x09 0x02 0xa1 0x01 0x85 0x02 0x09 0x01 0xa1 0x00 0x05 0x09 0x19 0x01 0x29 0x08 0x15 0x00 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 0x05 0x01 0x09 0x30 0x09 0x31 0x16 0x01 0xf8 0x26 0xff 0x07 0x75 0x0c 0x95 0x02 0x81 0x06 0x09 0x38 0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x01 0x81 0x06 0x05 0x0c 0x0a 0x38 0x02 0x81 0x06 0x05 0x09 0x19 0x09 0x29 0x10 0x15 0x00 0x25 0x01 0x95 0x08 0x75 0x01 0x81 0x02 0xc0 0xc0 0x06 0x00 0xff 0x09 0x01 0xa1 0x01 0x85 0x10 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff 0x00 0x09 0x01 0x81 0x00 0x09 0x01 0x91 0x00 0xc0 }; }