Code: Select all
subprocess.call(['sudo hciconfig hci0 piscan'])Thanks!
Code: Select all
subprocess.call(['sudo hciconfig hci0 piscan'])No, that's not correct. Discoverable mode is separate from listening.twin802 wrote:I believe that when the server "listens" on a port, then the bluetooth will become discoverable.
Code: Select all
subprocess.call(['sudo', 'hciconfig', 'hci0', 'piscan'])Thanks! It really worked, it solved my problem!Actually, the subprocess with 'sudo' works fine, as long as you get the syntax right.
CODE: SELECT ALL
subprocess.call(['sudo', 'hciconfig', 'hci0', 'piscan'])
This is by far the easiest method
Code: Select all
import dbus
import dbus.mainloop.glib
global mainloop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
adapter_props = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/hci0'),
"org.freedesktop.DBus.Properties");
adapter_props.Set("org.bluez.Adapter1", "Discoverable", dbus.Boolean(1))
Code: Select all
import dbus
bus = dbus.SystemBus()
player = bus.get_object('org.bluez','/org/bluez/hci0/dev_D8_50_E6_73_23_4C/player0')
#player.Pause(dbus_interface='org.bluez.MediaPlayer1')
BT_Media_iface = dbus.Interface(player, dbus_interface='org.bluez.MediaPlayer1')
BT_Media_iface.Pause()