Bluetoothキーボードを使えるようにしてみる(はずだったが頓挫)。
環境
# uname -a Linux rasp01 4.4.13+ #894 Mon Jun 13 12:43:26 BST 2016 armv6l GNU/Linux
インストール。
# apt-get install bluetooth
Bluetoothドングルを挿す。
設定コマンド実行。
$ bluetoothctl [NEW] Controller 00:09:DD:40:2C:19 rasp01 [default] [bluetooth]# power on Changing power on succeeded [CHG] Controller 00:09:DD:40:2C:19 Powered: yes [bluetooth]# agent on Agent registered [bluetooth]# default-agent Default agent request successful [bluetooth]#
ここで、Bluetoothキーボードの電源を入れ、リンクボタンを押す。
[bluetooth]# scan on Discovery started [CHG] Controller 00:09:DD:40:2C:19 Discovering: yes [NEW] Device 20:73:E0:12:31:18 20-73-E0-12-31-18 [CHG] Device 20:73:E0:12:31:18 LegacyPairing: no [CHG] Device 20:73:E0:12:31:18 Name: BSKBB15 [CHG] Device 20:73:E0:12:31:18 Alias: BSKBB15 [CHG] Device 20:73:E0:12:31:18 LegacyPairing: yes [bluetooth]#
ここまで表示されるまで少々待つこと。
[bluetooth]# devices Device 20:73:E0:12:31:18 BSKBB15 [bluetooth]# pair [TAB]キーを押すと、上記のデバイス名が自動入力される Attempting to pair with 20:73:E0:12:31:18 [CHG] Device 20:73:E0:12:31:18 Connected: yes [agent] PIN code: 411014 (PIN code は毎回ランダム) [CHG] Device 20:73:E0:12:31:18 Paired: yes Pairing successful [CHG] Device 20:73:E0:12:31:18 Connected: no [bluetooth]# connect 20:73:E0:12:31:18 (この辺りでエラーになることがある。原因はよくわからない) Attempting to connect to 20:73:E0:12:31:18 [bluetooth]# trust 20:73:E0:12:31:18 [CHG] Device 20:73:E0:12:31:18 Trusted: yes Changing 20:73:E0:12:31:18 trust succeeded [bluetooth]# quit
なんだか途中でエラーが出ているが、ひとまずここまで。
一応この状態でBTキーボードが使えるようになる。OSリブートしても使える。
けれども、BTキーボードの電源をオフ~オンすると使えなくなったりして今ひとつ安定しない(どうもbluezのバグ、らしいですが詳しくはわかりません。カウボーイプログラマがどうとか・・・)
ペアリングを最初からやり直すには、bluetoothctlコマンドを起動し、
[bluetooth]# remove [TAB]キー
で、いったんデバイスを削除して再度やってみる。
または、以下の{BTデバイスのMACアドレス以下をごっそり削除してから bluetoothctl してみる。
/var/lib/bluetooth/{BTドングルのMACアドレス}/{BTデバイスのMACアドレス}
まちがえて/var以下を全部消さないでね。
なんかバグってるのが治ってない、っての聞いたらやる気失せた。
いずれまたやろう。
おしまい。