tips:bluetooth_keyboard_のセットアップ
差分
このページの2つのバージョン間の差分を表示します。
— | tips:bluetooth_keyboard_のセットアップ [2023/04/07 21:30] (現在) – 作成 - 外部編集 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ===== Bluetooth keyboard のセットアップ ===== | ||
+ | |||
+ | Bluetooth 経由で keyboard を使用する方法についてまとめます。 | ||
+ | |||
+ | ==== loader.conf の設定 ==== | ||
+ | |||
+ | USB の Bluetooth ドングルを指すと Bluetooth オーディオ向けにアイソクロナス転送 (isochronous transfer) の割り込みが非常にたくさん発生します。'' | ||
+ | |||
+ | Bluetooth オーディオを使わないのであれば、システムに余計な負荷をかけるだけですので、OFF にすることができます。 | ||
+ | |||
+ | FreeBSD 13.1 以降であれば、loader.conf に以下の設定を書き、再起動するとアイソクロナス転送を無効にできます。 | ||
+ | |||
+ | < | ||
+ | net.bluetooth.usb_isoc_enable=0 | ||
+ | </ | ||
+ | |||
+ | sysctl でも設定できますが、その場合は sysctl で設定後に Bluetooth ドングルを挿してください。 | ||
+ | 既に挿してある場合には一度抜き差しする必要があります。 | ||
+ | |||
+ | |||
+ | ==== 暗号化の設定 ==== | ||
+ | |||
+ | デフォルトの設定では Bluetooth の通信は暗号化されていません。うっかり root のパスワードをキーボードから打ち込み、それが盗聴されていた場合、パスワードの流出に繋がります。 | ||
+ | |||
+ | Bluetooth デバイスのデフォルトの設定は ''/ | ||
+ | |||
+ | Bluetooth のドングルが ubt0 として認識されている場合、''/ | ||
+ | |||
+ | < | ||
+ | authentication_enable=" | ||
+ | discoverable=" | ||
+ | encryption_mode=" | ||
+ | </ | ||
+ | |||
+ | この例では認証を有効にして、ホストアダプタを検出されないように設定し、データ通信を暗号化します。 | ||
+ | |||
+ | もし、Bluetoothドングルが複数ある場合にはその分のファイル (ubt1.conf, ubt2.conf, ...) を作成します。 | ||
+ | |||
+ | ==== デーモン起動 ==== | ||
+ | |||
+ | Bluetooth キーボードを使うために必要なデーモンを起動します。 | ||
+ | |||
+ | < | ||
+ | service bthidd enable | ||
+ | service bthidd start | ||
+ | service hcsecd enable | ||
+ | service hcsecd start | ||
+ | </ | ||
+ | |||
+ | ==== bluetooth-config ==== | ||
+ | |||
+ | Bluetooth のペアリングを簡単に行うためのスクリプトが FreeBSD 12.1 から用意されています。rootで '' | ||
+ | |||
+ | 以下に動作例を示します。 | ||
+ | |||
+ | < | ||
+ | <予め bluetooth キーボードをペアリングモードにしておく> | ||
+ | |||
+ | # bluetooth-config scan | ||
+ | Scanning for new Bluetooth devices (Attempt 1 of 5) ... done. | ||
+ | Found 2 new bluetooth devices (now scanning for names): | ||
+ | [ 1] b8: | ||
+ | [ 2] 28: | ||
+ | Select device to pair with [1-2, or 0 to rescan]: <1 を入力> | ||
+ | |||
+ | Adding device b8: | ||
+ | Enter friendly name. [AppleWirelessKeyboard]: | ||
+ | Notice: Using sanitized name" | ||
+ | |||
+ | Writing pairing information description block to / | ||
+ | (To get PIN, put device in pairing mode first.) | ||
+ | Enter PIN [nopin]: <pin 番号入力> | ||
+ | Stopping hcsecd. | ||
+ | Waiting for PIDS: 3027. | ||
+ | Starting hcsecd. | ||
+ | |||
+ | < | ||
+ | |||
+ | This device provides human interface device services. | ||
+ | Set it up? [yes]: < | ||
+ | syntax error in line 1 | ||
+ | Writing HID descriptor block to / | ||
+ | To re-read its config, bthidd must be restarted. | ||
+ | Warning: If a Bluetooth keyboard is being used, the connectionmight be lost. | ||
+ | It can be manually restarted later with | ||
+ | | ||
+ | Restart bthidd now? [yes]: < | ||
+ | Stopping bthidd. | ||
+ | Waiting for PIDS: 1813. | ||
+ | Starting bthidd. | ||
+ | </ | ||
+ | |||
+ | もし、エラーが発生した場合は '' | ||
+ | |||
+ | |||
+ | ==== 接続確認 ==== | ||
+ | |||
+ | Bluetooth ドングルが ubt0 で認識されている場合、以下のコマンドで接続を確認できます。 | ||
+ | |||
+ | < | ||
+ | $ hccontrol -n ubt0hci read_connection_list | ||
+ | Remote BD_ADDR | ||
+ | AppleWireless_ | ||
+ | </ | ||
+ | |||
+ | Encrypt が P2P になっていれば、データ通信が暗号化されています。 | ||
tips/bluetooth_keyboard_のセットアップ.1680839183.txt.gz · 最終更新: 2023/04/07 12:50 (外部編集)