Package: intone / 0.77+git20120308-1

use-dbus-to-set-scenario.patch Patch series | download
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
Description: Use D-Bus methods for scenario setting
 alsactl needs to be run as root while every client can ask
 the framework to set the scenario.
 .
 Furthermore different distributions use different paths to
 store their state files in, so we can also abstract from it
 by using D-Bus
Author: David Kalnischkies <kalnischkies@gmail.com>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605888
Last-Update: 2010-12-15

--- a/src/dbus-stuff.c
+++ b/src/dbus-stuff.c
@@ -149,3 +149,19 @@
 	e_dbus_message_send(conn, msg, dbus_reply_cb, -1, NULL);
 	dbus_message_unref(msg);
 }
+
+void set_audio_scenario(char const * const scenario)
+{
+	DBusMessage *msg;
+	msg = dbus_message_new_method_call(
+		"org.freesmartphone.odeviced",
+		"/org/freesmartphone/Device/Audio",
+		"org.freesmartphone.Device.Audio",
+		"SetScenario"
+	);
+
+	dbus_message_append_args (msg, DBUS_TYPE_STRING, &scenario, DBUS_TYPE_INVALID);
+
+	e_dbus_message_send(conn, msg, dbus_reply_cb, -1, NULL);
+	dbus_message_unref(msg);
+}
--- a/src/dbus-stuff.h
+++ b/src/dbus-stuff.h
@@ -29,6 +29,7 @@
 void dbus_reply_cb(void *data, DBusMessage *replymsg, DBusError *error);
 void bluetooth_on(void);
 void bluetooth_off(void);
+void set_audio_scenario(char const * const scenario);
 
 E_DBus_Connection *conn;
 extern void play_button_clicked(void *data, Evas_Object *obj, void *event_info);
--- a/src/main.c
+++ b/src/main.c
@@ -66,7 +66,8 @@
 	if (bt)bluetooth_off();
 	release_cpu ();
 	//restore alsa state
-	ret = system("alsactl -f /usr/share/shr/scenarii/stereoout.state restore");
+	set_audio_scenario("headset"); // we have no way to force reload of a state
+	set_audio_scenario("stereoout");
 	elm_exit();
 }