Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

RasPi 3 BのオンボードBluetooth/WiFiを無効化する

外付けUARTと衝突するだとか、あるいは消費電力やセキュリティの問題でBluetoothを無効化したいことってありますよね。
そういうときはraspbianのbootオプションが使えます。

実際のところ

RasPiのBluetoothを無効化するには、
boot設定の末尾に以下のようなコマンドで追記してやります。

$ sudo printf "# Disable Bluetooth\ndtoverlay=pi3-disable-bt\n"  >> /boot/config.txt

何をしている?

上記コマンドではDT……つまりDevice Treeの設定を上書きしています。
説明書きを 読むと、いかのような説明があります。

Name:   pi3-disable-bt
Info:   Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15
        N.B. To disable the systemd service that initialises the modem so it
        doesn't use the UART, use 'sudo systemctl disable hciuart'.
Load:   dtoverlay=pi3-disable-bt
Params: <None>

また、その近くにBluetoothmini-UART扱いに変更するコマンドもあります。

Name:   pi3-miniuart-bt
Info:   Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
        UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
        usable baudrate.
        N.B. It is also necessary to edit /lib/systemd/system/hciuart.service
        and replace ttyAMA0 with ttyS0, unless you have a system with udev rules
        that create /dev/serial0 and /dev/serial1, in which case use
        /dev/serial1 instead because it will always be correct. Furthermore,
        you must also set core_freq=250 in config.txt or the miniuart will not
        work.
Load:   dtoverlay=pi3-miniuart-bt
Params: <None>

WiFiは"pi3-disable-wifi"のようですね。

Name:   pi3-disable-wifi
Info:   Disable Pi3 onboard WiFi
Load:   dtoverlay=pi3-disable-wifi
Params: <None>