2020年5月11日 星期一

如何啟動Bluetooth 模組 ?

每次想要做點小事,就會出現一堆不相干的問題,然後就要讀一堆東西,之後又忘記原先想要做的事情。

這次的題目是延續之前的問題? 如何開關Bluetooth模組? 這個動作就是我們搭飛機的時候,空姐會在起飛的時候要我們關掉藍芽,也就是進飛航模式。前面那篇已經測試過了,hciconfig up/down 是關不掉BT模組的。

問題很小,但衍伸的討論卻不小。先講如何打開好了。命令簡單,

# systemctl enable bluetooth.service
# systemctl start bluetooth.service
# systemctl status bluetooth.service

第一行命令敲下去

# systemctl enable bluetooth.service  <Enter>
# systemctl: command not found

連忙
# ps -ef | grep systemd  <Enter>
root     24009     1  0  5月03 ?      00:00:00 /lib/systemd/systemd-udevd --daemon
root     27526     1  0  5月03 ?      00:00:00 /lib/systemd/systemd-logind

誰知道系統之中明明有 systemd 再跑,但沒有 systemctl,於是只好多作好幾步;

# sudo apt-get install -reinstall systemd <Enter>

一串訊息之後,終於重新裝好了 systmed。想問甚麼是 systemd ? 簡單說,就是 Windows/Android之中,System Services的概念,細節就不談下去了。


忙了半天還不能RUN,後來才發現 systemd 要到 15.04 之後才能使用,但我的版本

# lsb_release -a <Enter>

發現 Ubuntu 14.04.6,所以Run起來似乎怪怪的。於是放棄

systemctl enable bluetooth.service
# systemctl start bluetooth.service
# systemctl status bluetooth.service

這組命令,改試 rfkill
root@luke-G50:/home/dang# rfkill list
0: ideapad_wlan: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: ideapad_bluetooth: Bluetooth
        Soft blocked: no
        Hard blocked: no
2: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

如果想要關掉Bluetooth,可以

# rfkill unblock bluetooth <Enter>
# rfkill list <Enter>
0: ideapad_wlan: Wireless LAN 
        Soft blocked: no 
        Hard blocked: no 
1: ideapad_bluetooth: Bluetooth 
        Soft blocked: yes 
        Hard blocked: no 
2: phy0: Wireless LAN 
        Soft blocked: no 
        Hard blocked: no 

關閉全部無線裝置可以用下列命令:

# sudo rfkill block all <Enter>



沒有留言:

張貼留言