mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
144 lines
5 KiB
Diff
144 lines
5 KiB
Diff
|
From 034d5db9d017cdcd71ee95b0576ae974aad590f5 Mon Sep 17 00:00:00 2001
|
||
|
From: Nedko Arnaudov <nedko@arnaudov.name>
|
||
|
Date: Tue, 26 Nov 2013 23:47:58 +0200
|
||
|
Subject: [PATCH] control unique port names over DBUS
|
||
|
|
||
|
patch by micahscopes@gmail.com
|
||
|
sr#3098
|
||
|
---
|
||
|
a2j_control | 12 ++++++++++++
|
||
|
conf.h | 1 +
|
||
|
dbus_iface_control.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
3 files changed, 66 insertions(+)
|
||
|
|
||
|
diff --git a/a2j_control b/a2j_control
|
||
|
index 10b2db7..bd78aad 100755
|
||
|
--- a/a2j_control
|
||
|
+++ b/a2j_control
|
||
|
@@ -24,6 +24,8 @@ def main():
|
||
|
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"
|
||
|
+ print " dup - disallow unique port names"
|
||
|
+ print " aup - allow unique port names"
|
||
|
sys.exit(0)
|
||
|
|
||
|
bus = dbus.SessionBus()
|
||
|
@@ -56,6 +58,10 @@ def main():
|
||
|
print "Hardware exported"
|
||
|
else:
|
||
|
print "Hardware not exported"
|
||
|
+ if control_iface.get_disable_port_uniqueness():
|
||
|
+ print "Avoiding unique port names"
|
||
|
+ else:
|
||
|
+ print "Allowing unique port names"
|
||
|
elif arg == "gjcn":
|
||
|
print "--- get jack client name"
|
||
|
print control_iface.get_jack_client_name()
|
||
|
@@ -97,6 +103,12 @@ def main():
|
||
|
elif arg == 'dhw':
|
||
|
print "--- disable export of hardware ports"
|
||
|
control_iface.set_hw_export(False)
|
||
|
+ elif arg == 'aup':
|
||
|
+ print "--- allow unique port names"
|
||
|
+ control_iface.set_disable_port_uniqueness(False)
|
||
|
+ elif arg == 'dup':
|
||
|
+ print "--- disallow unique port names"
|
||
|
+ control_iface.set_disable_port_uniqueness(True)
|
||
|
else:
|
||
|
print "Unknown command '%s'" % arg
|
||
|
except dbus.DBusException, e:
|
||
|
diff --git a/conf.h b/conf.h
|
||
|
index 604eee7..f4303f7 100644
|
||
|
--- a/conf.h
|
||
|
+++ b/conf.h
|
||
|
@@ -22,6 +22,7 @@
|
||
|
#define CONF_H__AE361BE4_EE60_4F5C_B2D4_13D71A525018__INCLUDED
|
||
|
|
||
|
extern bool g_a2j_export_hw_ports;
|
||
|
+extern bool g_disable_port_uniqueness;
|
||
|
extern char * g_a2j_jack_server_name;
|
||
|
|
||
|
void
|
||
|
diff --git a/dbus_iface_control.c b/dbus_iface_control.c
|
||
|
index bd894e7..7a1ae13 100644
|
||
|
--- a/dbus_iface_control.c
|
||
|
+++ b/dbus_iface_control.c
|
||
|
@@ -99,6 +99,49 @@ static void a2j_dbus_get_hw_export(struct a2j_dbus_method_call * call_ptr)
|
||
|
&hw_export);
|
||
|
}
|
||
|
|
||
|
+static void a2j_dbus_get_disable_port_uniqueness(struct a2j_dbus_method_call * call_ptr)
|
||
|
+{
|
||
|
+ dbus_bool_t disable_port_uniqueness;
|
||
|
+
|
||
|
+ disable_port_uniqueness = g_disable_port_uniqueness;
|
||
|
+
|
||
|
+ a2j_dbus_construct_method_return_single(
|
||
|
+ call_ptr,
|
||
|
+ DBUS_TYPE_BOOLEAN,
|
||
|
+ &disable_port_uniqueness);
|
||
|
+}
|
||
|
+
|
||
|
+static void a2j_dbus_set_disable_port_uniqueness(struct a2j_dbus_method_call * call_ptr)
|
||
|
+{
|
||
|
+ DBusError error;
|
||
|
+ dbus_bool_t disable_port_uniqueness;
|
||
|
+
|
||
|
+ if (a2j_is_started())
|
||
|
+ {
|
||
|
+ a2j_dbus_error(call_ptr, A2J_DBUS_ERROR_BRIDGE_RUNNING, "Bridge is started");
|
||
|
+ return;
|
||
|
+ }
|
||
|
+
|
||
|
+ dbus_error_init(&error);
|
||
|
+
|
||
|
+ if (!dbus_message_get_args(
|
||
|
+ call_ptr->message,
|
||
|
+ &error,
|
||
|
+ DBUS_TYPE_BOOLEAN, &disable_port_uniqueness,
|
||
|
+ DBUS_TYPE_INVALID))
|
||
|
+ {
|
||
|
+ a2j_dbus_error(call_ptr, A2J_DBUS_ERROR_INVALID_ARGS, "Invalid arguments to method \"%s\"", call_ptr->method_name);
|
||
|
+ dbus_error_free(&error);
|
||
|
+ return;
|
||
|
+ }
|
||
|
+
|
||
|
+ g_disable_port_uniqueness = disable_port_uniqueness;
|
||
|
+
|
||
|
+ a2j_info("Unique port names %s.", g_disable_port_uniqueness ? "disabled": "enabled");
|
||
|
+
|
||
|
+ a2j_dbus_construct_method_return_void(call_ptr);
|
||
|
+}
|
||
|
+
|
||
|
static
|
||
|
void
|
||
|
a2j_dbus_start(
|
||
|
@@ -377,6 +420,14 @@ A2J_DBUS_METHOD_ARGUMENTS_BEGIN(get_hw_export)
|
||
|
A2J_DBUS_METHOD_ARGUMENT("hw_export", DBUS_TYPE_BOOLEAN_AS_STRING, A2J_DBUS_DIRECTION_OUT)
|
||
|
A2J_DBUS_METHOD_ARGUMENTS_END
|
||
|
|
||
|
+A2J_DBUS_METHOD_ARGUMENTS_BEGIN(set_disable_port_uniqueness)
|
||
|
+ A2J_DBUS_METHOD_ARGUMENT("disable_port_uniqueness", DBUS_TYPE_BOOLEAN_AS_STRING, A2J_DBUS_DIRECTION_IN)
|
||
|
+A2J_DBUS_METHOD_ARGUMENTS_END
|
||
|
+
|
||
|
+A2J_DBUS_METHOD_ARGUMENTS_BEGIN(get_disable_port_uniqueness)
|
||
|
+ A2J_DBUS_METHOD_ARGUMENT("disable_port_uniqueness", DBUS_TYPE_BOOLEAN_AS_STRING, A2J_DBUS_DIRECTION_OUT)
|
||
|
+A2J_DBUS_METHOD_ARGUMENTS_END
|
||
|
+
|
||
|
A2J_DBUS_METHODS_BEGIN
|
||
|
A2J_DBUS_METHOD_DESCRIBE(exit, a2j_dbus_exit)
|
||
|
A2J_DBUS_METHOD_DESCRIBE(start, a2j_dbus_start)
|
||
|
@@ -387,6 +438,8 @@ A2J_DBUS_METHODS_BEGIN
|
||
|
A2J_DBUS_METHOD_DESCRIBE(map_jack_port_to_alsa, a2j_dbus_map_jack_port_to_alsa)
|
||
|
A2J_DBUS_METHOD_DESCRIBE(set_hw_export, a2j_dbus_set_hw_export)
|
||
|
A2J_DBUS_METHOD_DESCRIBE(get_hw_export, a2j_dbus_get_hw_export)
|
||
|
+ A2J_DBUS_METHOD_DESCRIBE(set_disable_port_uniqueness, a2j_dbus_set_disable_port_uniqueness)
|
||
|
+ A2J_DBUS_METHOD_DESCRIBE(get_disable_port_uniqueness, a2j_dbus_get_disable_port_uniqueness)
|
||
|
A2J_DBUS_METHODS_END
|
||
|
|
||
|
A2J_DBUS_SIGNAL_ARGUMENTS_BEGIN(bridge_started)
|
||
|
--
|
||
|
2.15.0
|
||
|
|