/usr/bin/a2j_control is in a2jmidid 7+dfsg0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #!/usr/bin/python
name_base = 'org.gna.home.a2jmidid'
control_interface_name = name_base + '.control'
service_name = name_base
import sys
import os
from traceback import print_exc
import dbus
def main():
if len(sys.argv) == 1:
print "Usage: %s [command] [command] ..." % os.path.basename(sys.argv[0])
print "Commands:"
print " exit - exit a2j bridge dbus service"
print " start - start bridging"
print " stop - stop brdiging"
print " status - get bridging status"
print " gjcn - get JACK client name"
print " ma2jp <client_id> <port_id> - map ALSA to JACK playback port"
print " ma2jc <client_id> <port_id> - map ALSA to JACK capture port"
print " mj2a <jack_port_name> - map JACK port to ALSA port"
print " ehw - enable export of hardware ports"
print " dhw - disable export of hardware ports"
sys.exit(0)
bus = dbus.SessionBus()
controller = bus.get_object(service_name, "/")
control_iface = dbus.Interface(controller, control_interface_name)
# check arguments
index = 1
while index < len(sys.argv):
arg = sys.argv[index]
index += 1
try:
if arg == "exit":
print "--- exit"
control_iface.exit()
elif arg == "start":
print "--- start"
control_iface.start()
elif arg == "stop":
print "--- stop"
control_iface.stop()
elif arg == "status":
print "--- status"
if control_iface.is_started():
print "Bridging enabled"
else:
print "Bridging disabled"
elif arg == "gjcn":
print "--- get jack client name"
print control_iface.get_jack_client_name()
elif arg == 'ma2jp':
print "--- map ALSA to JACK playback port"
if index + 1 >= len(sys.argv):
print "map ALSA to JACK playback port command requires ALSA client ID and ALSA port ID arguments"
sys.exit()
client_id = sys.argv[index]
index += 1
port_id = sys.argv[index]
index += 1
print "'%s'" % control_iface.map_alsa_to_jack_port(client_id, port_id, True)
elif arg == 'ma2jc':
print "--- map ALSA to JACK capture port"
if index + 1 >= len(sys.argv):
print "map ALSA to JACK capture port command requires ALSA client ID and ALSA port ID arguments"
sys.exit()
client_id = sys.argv[index]
index += 1
port_id = sys.argv[index]
index += 1
print "'%s'" % control_iface.map_alsa_to_jack_port(client_id, port_id, False)
elif arg == 'mj2a':
print "--- map JACK to ALSA port"
if index >= len(sys.argv):
print "map JACK to ALSA port command requires JACK port name argument"
sys.exit()
jack_port = sys.argv[index]
index += 1
out = control_iface.map_jack_port_to_alsa(jack_port)
print "%u:%u ('%s':'%s')" % (int(out[0]), int(out[1]), str(out[2]), str(out[3]))
elif arg == 'ehw':
print "--- enable export of hardware ports"
control_iface.set_hw_export(True)
elif arg == 'dhw':
print "--- disable export of hardware ports"
control_iface.set_hw_export(False)
else:
print "Unknown command '%s'" % arg
except dbus.DBusException, e:
print "DBus exception: %s" % str(e)
if __name__ == '__main__':
main()
|