在UOS想通过命令操作蓝牙功能开关,尝试过hciconfig、rfkill、bluetoothctl等命令都不行,最后通过gdbus方式成功,随手记录
打开蓝牙:
gdbus call --session -d com.deepin.daemon.Bluetooth -o /com/deepin/daemon/Bluetooth -m com.deepin.daemon.Bluetooth.SetAdapterPowered /org/bluez/hci0 true
关闭蓝牙:
gdbus call --session -d com.deepin.daemon.Bluetooth -o /com/deepin/daemon/Bluetooth -m com.deepin.daemon.Bluetooth.SetAdapterPowered /org/bluez/hci0 false
新增wifi开关命令
打开:
dbus-send --session --dest=com.deepin.daemon.Network --print-reply /com/deepin/daemon/Network com.deepin.daemon.Network.EnableDevice variant:objpath:"/org/freedesktop/NetworkManager/Devices/9" variant:boolean:true
关闭:
dbus-send --session --dest=com.deepin.daemon.Network --print-reply /com/deepin/daemon/Network com.deepin.daemon.Network.EnableDevice variant:objpath:"/org/freedesktop/NetworkManager/Devices/9" variant:boolean:false