Plugin.
Subsystems (2)
PATCH 1/1 Plugin.
Hi Marcel/Johan,
Attaching a patch for the telephony plugin framework.
I have added a 'configure' option (--enable-plugin) which compiles all the plugins (currently only test plugin). Then the specific plugin can be selected through audio.conf.
Let me know what you think.
Marcel, can you approve and create the plugin files (audio/hfp_plugin_test.c and audio/hfp_plugin.h)?
Thanks,
Alok.
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/bluez/utils/acinclude.m4,v
retrieving revision 1.127
acinclude.m4 +9 -1
@@ -60,14 +60,17 @@ AC_DEFUN([AC_INIT_BLUEZ], [ else storagedir="${localstatedir}/lib/bluetooth" fi servicedir="${libdir}/bluetooth" + + plugindir="${libdir}/bluetooth" AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}", [Directory for the configuration files]) AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}", [Directory for the storage files]) AC_DEFINE_UNQUOTED(SERVICEDIR, "${servicedir}", [Directory for the service programs]) + AC_DEFINE_UNQUOTED(PLUGINDIR, "${plugindir}", [Directory for the telephony plugins]) ]) AC_DEFUN([AC_PATH_BLUEZ], [ PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes, AC_MSG_ERROR(Bluetooth library is required)) AC_SUBST(BLUEZ_CFLAGS)
@@ -184,10 +187,11 @@ AC_DEFUN([AC_ARG_BLUEZ], [ alsa_enable=${alsa_found} obex_enable=${openobex_found} glib_enable=no gstreamer_enable=${gstreamer_found} audio_enable=yes + plugin_enable=no input_enable=yes serial_enable=yes network_enable=yes sync_enable=no echo_enable=no
@@ -278,10 +282,14 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AC_ARG_ENABLE(audio, AC_HELP_STRING([--enable-audio], [enable audio service]), [ audio_enable=${enableval} ]) + AC_ARG_ENABLE(plugin, AC_HELP_STRING([--enable-plugin], [enable telephony plugins]), [ + plugin_enable=${enableval} + ]) + AC_ARG_ENABLE(input, AC_HELP_STRING([--enable-input], [enable input service]), [ input_enable=${enableval} ]) AC_ARG_ENABLE(serial, AC_HELP_STRING([--enable-serial], [enable serial service]), [
@@ -317,11 +325,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ ]) AC_ARG_ENABLE(dund, AC_HELP_STRING([--enable-dund], [install DUN daemon]), [ dund_enable=${enableval} ]) - AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [install test programs]), [ test_enable=${enableval} ])
@@ -413,10 +420,11 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes") AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes") AM_CONDITIONAL(OBEX, test "${obex_enable}" = "yes" && test "${openobex_found}" = "yes") AM_CONDITIONAL(GSTREAMER, test "${gstreamer_enable}" = "yes" && test "${gstreamer_found}" = "yes") AM_CONDITIONAL(AUDIOSERVICE, test "${audio_enable}" = "yes") + AM_CONDITIONAL(PLUGIN, test "${plugin_enable}" = "yes") AM_CONDITIONAL(INPUTSERVICE, test "${input_enable}" = "yes") AM_CONDITIONAL(SERIALSERVICE, test "${serial_enable}" = "yes") AM_CONDITIONAL(NETWORKSERVICE, test "${network_enable}" = "yes") AM_CONDITIONAL(SYNCSERVICE, test "${sync_enable}" = "yes" && test "${opensync_found}" = "yes") AM_CONDITIONAL(ECHOSERVICE, test "${echo_enable}" = "yes")
Index: audio/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/utils/audio/Makefile.am,v retrieving revision 1.46
Makefile.am +13 -3
@@ -14,11 +14,22 @@ bluetoothd_service_audio_SOURCES = main. manager.h manager.c headset.h headset.c ipc.h ipc.c unix.h unix.c \ device.h device.c gateway.h gateway.c \ sink.c sink.h avdtp.c avdtp.h a2dp.c a2dp.h control.c control.h bluetoothd_service_audio_LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ @GMODULE_LIBS@ + +if PLUGIN +plugindir = $(libdir)/bluetooth + +plugin_LTLIBRARIES = hfp_plugin_test.la + +hfp_plugin_test_la_SOURCES = hfp_plugin_test.c hfp_plugin.h +hfp_plugin_test_la_LDFLAGS = -module +hfp_plugin_test_la_LIBADD = @GLIB_LIBS@ +hfp_plugin_test_la_CFLAGS = @GLIB_CFLAGS@ +endif if ALSA alsadir = $(libdir)/alsa-lib alsa_LTLIBRARIES = libasound_module_pcm_bluetooth.la libasound_module_ctl_bluetooth.la
@@ -52,13 +63,12 @@ libgstbluetooth_la_LDFLAGS = -module -av libgstbluetooth_la_LIBADD = @SBC_LIBS@ @GSTREAMER_LIBS@ -lgstaudio-0.10 -lgstrtp-0.10 libgstbluetooth_la_CFLAGS = @GSTREAMER_CFLAGS@ @SBC_CFLAGS@ endif endif -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GMODULE_CFLAGS@ INCLUDES = -I$(top_srcdir)/common EXTRA_DIST = audio.service audio.conf audio-api.txt test-audio asound.conf MAINTAINERCLEANFILES = Makefile.in -
Index: audio/audio.conf
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio.conf,v
retrieving revision 1.5
audio.conf +5 -0
@@ -30,9 +30,14 @@ VoiceTags=false RejectingCalls=false EnhancedCallStatus=false EnhancedCallControl=false ExtendedErrorResultCodes=false +#HFP telephony plugin options +Plugin=test +#Values can be test, openmoko or telepathy based on +#the telephony system. + # Just an example of potential config options for the other interfaces #[A2DP] #SBCSources=1 #MPEG12Sources=0
Index: audio/device.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/device.c,v
retrieving revision 1.26
device.c +1 -0
@@ -31,10 +31,11 @@#include <unistd.h> #include <sys/stat.h> #include <netinet/in.h> #include <glib.h> +#include <gmodule.h> #include <dbus/dbus.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h>
Index: audio/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/manager.c,v
retrieving revision 1.90
manager.c +45 -0
100 lines not on this page · raw message
Index: audio/unix.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/unix.c,v
retrieving revision 1.64
unix.c +1 -0
@@ -36,10 +36,11 @@#include <bluetooth/bluetooth.h> #include <bluetooth/sdp.h> #include <dbus/dbus.h> #include <glib.h> +#include <gmodule.h> #include "logging.h" #include "dbus.h" #include "ipc.h" #include "device.h"
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Alok,
Some comments below.
acinclude.m4 AC_DEFUN([AC_ARG_BLUEZ], [ · line 290
Quoted 4 lines · Alok
acinclude.m4 +4
-0+ AC_ARG_ENABLE(plugin, AC_HELP_STRING([--enable-plugin], [enable telephony plugins]), [ + plugin_enable=${enableval} + ]) +
Maybe --enable-hfp-plugin would be better since it's not clear what plugin is in question.
Makefile.am bluetoothd_service_audio_SOURCES = main. · line 30
Quoted 10 lines
Makefile.am +10
-0+if PLUGIN +plugindir = $(libdir)/bluetooth + +plugin_LTLIBRARIES = hfp_plugin_test.la + +hfp_plugin_test_la_SOURCES = hfp_plugin_test.c hfp_plugin.h +hfp_plugin_test_la_LDFLAGS = -module +hfp_plugin_test_la_LIBADD = @GLIB_LIBS@ +hfp_plugin_test_la_CFLAGS = @GLIB_CFLAGS@ +endif
Isn't there rist that these files get left out of "make dist" if you didn't give --enable-plugin to configure?
manager.c static GIOChannel *server_socket(uint8_t · line 1549
Quoted 7 lines
manager.c +7
-0+int load_hfp_plugin (GKeyFile *config) +{ +gchar *str =NULL ; +GError *err =NULL ; +char filename[PATH_MAX ]; + + str =g_key_file_get_string (config,"Headset" ,"Plugin" , &err);
Incorrect indentation and missing check for config == NULL
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (load_hfp_plugin(config) < 0) + return -1;
I think we should keep the current policy that the audio service gets run successfully with some sane set of defaults if there is no audio.conf present in the filesystem. This change looks like it will make the audio service fail either if audio.conf doesn't exist or if it doesn't contain a Plugin entry.
unix.c line 41
Quoted 9 lines
unix.c +1
-0@@ -36,10 +36,11 @@#include <bluetooth/bluetooth.h> #include <bluetooth/sdp.h> #include <dbus/dbus.h> #include <glib.h> +#include <gmodule.h>
Why do you need to add this include since there are no other changes to this file in your patch?
Johan
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Johan,
Find my responses inline.
Quoted 4 lines · Johan Hedberg
Hi Alok,
Some comments below.
Quoted 9 lines
acinclude.m4 AC_DEFUN([AC_ARG_BLUEZ], [ · line 290
Quoted 4 lines · Alok
acinclude.m4 +4
-0+ AC_ARG_ENABLE(plugin, AC_HELP_STRING([--enable-plugin], [enable telephony plugins]), [ + plugin_enable=${enableval} + ]) +Maybe --enable-hfp-plugin would be better since it's not clear what plugin is in question.
sure. "--enable-hfp-plugin" sounds fine.
Quoted 5 lines
Quoted 5 lines
Makefile.am +5
-0+if PLUGIN +plugindir = $(libdir)/bluetooth + +plugin_LTLIBRARIES = hfp_plugin_test.la +
Quoted 9 lines
Makefile.am bluetoothd_service_audio_SOURCES = main. · line 30
Quoted 5 lines
Makefile.am +5
-0+hfp_plugin_test_la_SOURCES = hfp_plugin_test.c hfp_plugin.h +hfp_plugin_test_la_LDFLAGS = -module +hfp_plugin_test_la_LIBADD = @GLIB_LIBS@ +hfp_plugin_test_la_CFLAGS = @GLIB_CFLAGS@ +endifIsn't there rist that these files get left out of "make dist" if you didn't give --enable-plugin to configure?
I am not sure I understand. Is there some rule missing or something?
Quoted 9 lines
manager.c static GIOChannel *server_socket(uint8_t · line 1549
Quoted 7 lines
manager.c +7
-0+int load_hfp_plugin (GKeyFile *config) +{ +gchar *str =NULL ; +GError *err =NULL ; +char filename[PATH_MAX ]; + + str =g_key_file_get_string (config,"Headset" ,"Plugin" , &err);Incorrect indentation and missing check for config == NULL
Will fix that.
Quoted 11 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ if (load_hfp_plugin(config) < 0) + return -1;I think we should keep the current policy that the audio service gets run successfully with some sane set of defaults if there is no audio.conf present in the filesystem. This change looks like it will make the audio service fail either if audio.conf doesn't exist or if it doesn't contain a Plugin entry.
As far as I remember, Marcel had commented that there should not be a default plugin. (in case of no audio.conf). But I am open to the idea. We can have the test plugin as the default plugin.
Quoted 4 lines
Quoted 4 lines
unix.c +0
-0@@ -36,10 +36,11 @@
Quoted 9 lines
unix.c line 41
Quoted 5 lines
unix.c +1
-0#include <bluetooth/bluetooth.h> #include <bluetooth/sdp.h> #include <dbus/dbus.h> #include <glib.h> +#include <gmodule.h> Why do you need to add this include since there are no other changes to this file in your patch?
You are right. This is unnecessary. will remove it.
Quoted 2 lines
Johan
Thanks,
Alok.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Johan/Marcel,
Attaching the updated Plugin patch.
Let me know what you think.
-Alok.
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/bluez/utils/acinclude.m4,v
retrieving revision 1.127
acinclude.m4 +9 -1
@@ -60,14 +60,17 @@ AC_DEFUN([AC_INIT_BLUEZ], [ else storagedir="${localstatedir}/lib/bluetooth" fi servicedir="${libdir}/bluetooth" + + plugindir="${libdir}/bluetooth" AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}", [Directory for the configuration files]) AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}", [Directory for the storage files]) AC_DEFINE_UNQUOTED(SERVICEDIR, "${servicedir}", [Directory for the service programs]) + AC_DEFINE_UNQUOTED(PLUGINDIR, "${plugindir}", [Directory for the telephony plugins]) ]) AC_DEFUN([AC_PATH_BLUEZ], [ PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes, AC_MSG_ERROR(Bluetooth library is required)) AC_SUBST(BLUEZ_CFLAGS)
@@ -184,10 +187,11 @@ AC_DEFUN([AC_ARG_BLUEZ], [ alsa_enable=${alsa_found} obex_enable=${openobex_found} glib_enable=no gstreamer_enable=${gstreamer_found} audio_enable=yes + plugin_enable=no input_enable=yes serial_enable=yes network_enable=yes sync_enable=no echo_enable=no
@@ -278,10 +282,14 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AC_ARG_ENABLE(audio, AC_HELP_STRING([--enable-audio], [enable audio service]), [ audio_enable=${enableval} ]) + AC_ARG_ENABLE(plugin, AC_HELP_STRING([--enable-hfp-plugin], [enable telephony plugins]), [ + plugin_enable=${enableval} + ]) + AC_ARG_ENABLE(input, AC_HELP_STRING([--enable-input], [enable input service]), [ input_enable=${enableval} ]) AC_ARG_ENABLE(serial, AC_HELP_STRING([--enable-serial], [enable serial service]), [
@@ -317,11 +325,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ ]) AC_ARG_ENABLE(dund, AC_HELP_STRING([--enable-dund], [install DUN daemon]), [ dund_enable=${enableval} ]) - AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [install test programs]), [ test_enable=${enableval} ])
@@ -413,10 +420,11 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes") AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes") AM_CONDITIONAL(OBEX, test "${obex_enable}" = "yes" && test "${openobex_found}" = "yes") AM_CONDITIONAL(GSTREAMER, test "${gstreamer_enable}" = "yes" && test "${gstreamer_found}" = "yes") AM_CONDITIONAL(AUDIOSERVICE, test "${audio_enable}" = "yes") + AM_CONDITIONAL(PLUGIN, test "${plugin_enable}" = "yes") AM_CONDITIONAL(INPUTSERVICE, test "${input_enable}" = "yes") AM_CONDITIONAL(SERIALSERVICE, test "${serial_enable}" = "yes") AM_CONDITIONAL(NETWORKSERVICE, test "${network_enable}" = "yes") AM_CONDITIONAL(SYNCSERVICE, test "${sync_enable}" = "yes" && test "${opensync_found}" = "yes") AM_CONDITIONAL(ECHOSERVICE, test "${echo_enable}" = "yes")
Index: audio/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/utils/audio/Makefile.am,v retrieving revision 1.46
Makefile.am +13 -3
@@ -14,11 +14,22 @@ bluetoothd_service_audio_SOURCES = main. manager.h manager.c headset.h headset.c ipc.h ipc.c unix.h unix.c \ device.h device.c gateway.h gateway.c \ sink.c sink.h avdtp.c avdtp.h a2dp.c a2dp.h control.c control.h bluetoothd_service_audio_LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ @GMODULE_LIBS@ + +if PLUGIN +plugindir = $(libdir)/bluetooth + +plugin_LTLIBRARIES = hfp_plugin_test.la + +hfp_plugin_test_la_SOURCES = hfp_plugin_test.c hfp_plugin.h +hfp_plugin_test_la_LDFLAGS = -module +hfp_plugin_test_la_LIBADD = @GLIB_LIBS@ +hfp_plugin_test_la_CFLAGS = @GLIB_CFLAGS@ +endif if ALSA alsadir = $(libdir)/alsa-lib alsa_LTLIBRARIES = libasound_module_pcm_bluetooth.la libasound_module_ctl_bluetooth.la
@@ -52,13 +63,12 @@ libgstbluetooth_la_LDFLAGS = -module -av libgstbluetooth_la_LIBADD = @SBC_LIBS@ @GSTREAMER_LIBS@ -lgstaudio-0.10 -lgstrtp-0.10 libgstbluetooth_la_CFLAGS = @GSTREAMER_CFLAGS@ @SBC_CFLAGS@ endif endif -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GMODULE_CFLAGS@ INCLUDES = -I$(top_srcdir)/common EXTRA_DIST = audio.service audio.conf audio-api.txt test-audio asound.conf MAINTAINERCLEANFILES = Makefile.in -
Index: audio/audio.conf
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio.conf,v
retrieving revision 1.5
audio.conf +5 -0
@@ -30,9 +30,14 @@ VoiceTags=false RejectingCalls=false EnhancedCallStatus=false EnhancedCallControl=false ExtendedErrorResultCodes=false +#HFP telephony plugin options +Plugin=test +#Values can be test, openmoko or telepathy based on +#the telephony system. + # Just an example of potential config options for the other interfaces #[A2DP] #SBCSources=1 #MPEG12Sources=0
Index: audio/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/manager.c,v
retrieving revision 1.90
manager.c +50 -0
105 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel