mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-26 06:13:30 +08:00
test-audio: Add --interface option
This commit is contained in:
parent
08efacdd30
commit
a17ad52653
@ -13,6 +13,8 @@ manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
|
||||
option_list = [
|
||||
make_option("-i", "--device", action="store",
|
||||
type="string", dest="dev_id"),
|
||||
make_option("-f", "--interface", action="store",
|
||||
type="string", dest="dev_if"),
|
||||
]
|
||||
parser = OptionParser(option_list=option_list)
|
||||
|
||||
@ -23,6 +25,11 @@ if options.dev_id:
|
||||
else:
|
||||
adapter_path = manager.DefaultAdapter()
|
||||
|
||||
if options.dev_if:
|
||||
interface = "org.bluez." + options.dev_if
|
||||
else:
|
||||
interface = "org.bluez.Audio"
|
||||
|
||||
adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
|
||||
"org.bluez.Adapter")
|
||||
|
||||
@ -35,8 +42,7 @@ if len(args) < 2:
|
||||
sys.exit(1)
|
||||
|
||||
device = adapter.FindDevice(args[1])
|
||||
audio = dbus.Interface(bus.get_object("org.bluez", device),
|
||||
"org.bluez.Audio")
|
||||
audio = dbus.Interface(bus.get_object("org.bluez", device), interface)
|
||||
|
||||
if args[0] == "connect":
|
||||
audio.Connect()
|
||||
|
Loading…
Reference in New Issue
Block a user