Active Topics

 


Reply
Thread Tools
Feathers McGraw's Avatar
Posts: 654 | Thanked: 2,368 times | Joined on Jul 2014 @ UK
#1
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).
 

The Following 2 Users Say Thank You to Feathers McGraw For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#2
better is add to rockpool proper api for controlling bluetooth.
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Feathers McGraw's Avatar
Posts: 654 | Thanked: 2,368 times | Joined on Jul 2014 @ UK
#3
Originally Posted by coderus View Post
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...
 

The Following User Says Thank You to Feathers McGraw For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#4
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,
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..

Last edited by Markkyboy; 2016-11-14 at 22:21.
 

The Following 5 Users Say Thank You to Markkyboy For This Useful Post:
Feathers McGraw's Avatar
Posts: 654 | Thanked: 2,368 times | Joined on Jul 2014 @ UK
#5
Originally Posted by Markkyboy View Post
To turn bluetooth ON via dbus, you can use...
Perfect, thanks!
 

The Following 3 Users Say Thank You to Feathers McGraw For This Useful Post:
Reply

Tags
bluetooth, rockpoold, systemd, user script


 
Forum Jump


All times are GMT. The time now is 15:04.