configurable D-Bus blueman object path to fix #483

The path to object org.blueman.Mechanism was originally hard-coded to
"/". But in some systems, the path may be "/org/blueman/mechanism". So
this commit adds an extra parameter to configure the path.
This commit is contained in:
Pi-Yueh Chuang 2019-12-18 16:39:48 -05:00
parent 9236b5279e
commit 747214f3da
No known key found for this signature in database
GPG key ID: 83F49ABBF34F879D

View file

@ -5,6 +5,7 @@ Parameters:
* bluetooth.device : the device to read state from (default is hci0)
* bluetooth.manager : application to launch on click (blueman-manager)
* bluetooth.dbus_destination : dbus destination (defaults to org.blueman.Mechanism)
* bluetooth.dbus_destination_path : dbus destination path (defaults to /)
"""
@ -97,10 +98,11 @@ class Module(bumblebee.engine.Module):
state = "true"
dst = self.parameter("dbus_destination", "org.blueman.Mechanism")
dst_path = self.parameter("dbus_destination_path", "/")
cmd = "dbus-send --system --print-reply --dest={}"\
" / org.blueman.Mechanism.SetRfkillState"\
" boolean:{}".format(dst, state)
" {} org.blueman.Mechanism.SetRfkillState"\
" boolean:{}".format(dst, dst_path, state)
bumblebee.util.execute(cmd)