maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Turn bluetooth on from commandline in SFOS (https://talk.maemo.org/showthread.php?t=98268)

Feathers McGraw 2016-11-13 00:23

Turn bluetooth on from commandline in SFOS
 
Does anyone know how to turn bluetooth on and off from the commandline in SFOS?

I've been rummaging with dbus, so far I discovered this using qdbus:

Code:

[nemo@Sailfish bluetooth]$ qdbus com.jolla.settings /com/jolla/settings/ui org.freedesktop.DBus.Properties.Set hci0 bar baz
Error: org.freedesktop.DBus.Error.UnknownInterface
Interface hci0 was not found in object /com/jolla/settings/ui

But I guess the problem is that I don't know the name of the bluetooth interface.

Anyone know how to do this? The end goal is to create a script to turn bluetooth on and restart rockpoold afterwards, and launch it as a user script with systemd (currently on fairphone 2 rockpool starts before bluetooth and therefore my pebble doesn't pair when I reboot until I turn on bluetooth and restart rockpool).

coderus 2016-11-13 00:34

Re: Turn bluetooth on from commandline in SFOS
 
better is add to rockpool proper api for controlling bluetooth.

Feathers McGraw 2016-11-13 11:26

Re: Turn bluetooth on from commandline in SFOS
 
Quote:

Originally Posted by coderus (Post 1518613)
better is add to rockpool proper api for controlling bluetooth.

It's only a problem for Fairphone 2 though, rockpool works fine on other devices...

Markkyboy 2016-11-13 12:22

Re: Turn bluetooth on from commandline in SFOS
 
To turn bluetooth ON via dbus, you can use;

Code:

dbus-send --system --print-reply --dest=net.connman /net/connman/technology/bluetooth net.connman.Technology.SetProperty string:"Powered" variant:boolean:true
To turn bluetooth OFF, change true for false at the end of the line;

Code:

dbus-send --system --print-reply --dest=net.connman /net/connman/technology/bluetooth net.connman.Technology.SetProperty string:"Powered" variant:boolean:false
Taken from an answer given by Schturman with solution from 'coderus' on TJC;

https://together.jolla.com/question/...onoff-via-cli/ - originally from - http://talk.maemo.org/showpost.php?p...6&postcount=64

Regards,

Feathers McGraw 2016-11-13 18:43

Re: Turn bluetooth on from commandline in SFOS
 
Quote:

Originally Posted by Markkyboy (Post 1518633)
To turn bluetooth ON via dbus, you can use...

Perfect, thanks!


All times are GMT. The time now is 13:21.

vBulletin® Version 3.8.8