Skip to contentSkip to conversation

Add new plugin to set adapter class

PATCH Bastien Nocera 2 participants 6 messages Sep 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

To replace the old code that was using HAL.

This allows us to avoid HAL usage, as it is deprecated.

Cheers

Quoted 1 line

From f8bb02df7e3c13f71105ceb8c116294cb3a0f6c2 Mon Sep 17 00:00:00 2001

From: Bastien Nocera <[email protected]>
Date: Mon, 6 Sep 2010 11:44:31 +0100
Subject: [PATCH] Add new plugin to set adapter class

This time based on the kernel exported DMI, rather than calling out to HAL. The HAL plugin can still be preferred with --enable-hal=yes passed to configure.

---
 Makefile.am          |    7 ++
 acinclude.m4         |    7 ++-
 plugins/formfactor.c |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 1 deletions(-)
 create mode 100644 plugins/formfactor.c
Makefile.am +7 -0
index 665c0a9..3fb948f 100644
@@ -199,8 +199,15 @@ endif
 builtin_modules += hciops
 builtin_sources += plugins/hciops.c
 
+if HAL
 builtin_modules += hal
 builtin_sources += plugins/hal.c
+else
+builtin_modules += formfactor
+builtin_sources += plugins/formfactor.c
+endif
+
+EXTRA_DIST += plugins/hal.c plugins/formfactor.c
 
 builtin_modules += storage
 builtin_sources += plugins/storage.c
acinclude.m4 +6 -1
index 25cd259..2566d0d 100644
@@ -178,7 +178,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	capng_enable=${capng_found}
 	sndfile_enable=${sndfile_found}
 	netlink_enable=no
-	hal_enable=${hal_found}
+	hal_enable=no
 	usb_enable=${usb_found}
 	cable_enable=${cable_found}
 	alsa_enable=${alsa_found}
@@ -337,6 +337,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 		maemo6_enable=${enableval}
 	])
 
+	AC_ARG_ENABLE(hal, AC_HELP_STRING([--enable-hal], [Use HAL to determine adapter class]), [
+		hal_enable=${enableval}
+	])
+
 	if (test "${fortify_enable}" = "yes"); then
 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 	fi
@@ -378,6 +382,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
 	AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes")
 	AM_CONDITIONAL(MCAP, test "${mcap_enable}" = "yes")
+	AM_CONDITIONAL(HAL, test "${hal_enable}" = "yes")
 	AM_CONDITIONAL(ATTRIBPLUGIN, test "${attrib_enable}" = "yes")
 	AM_CONDITIONAL(ECHOPLUGIN, test "no" = "yes")
 	AM_CONDITIONAL(PNATPLUGIN, test "${pnat_enable}" = "yes")
plugins/formfactor.c new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
1.7.0.1
#1 lore raw

Hi Bastien,

Makefile.am endif · line 208

Quoted 7 lines · Bastien Nocera
Makefile.am +5 -0
+if HAL
 builtin_modules += hal
 builtin_sources += plugins/hal.c
+else
+builtin_modules += formfactor
+builtin_sources += plugins/formfactor.c
+endif

Previously it was possible to --disable-hal and be sure that whatever is defined in main.conf gets used (this is e.g. something that has been important for us in Maemo/MeeGo). Your patch seems to make one of the two automated adapter class sources always be used and so potentially overriding what main.conf says. So I'd prefer to keep the possibility of disably any such plugins completely.

Johan

#2 lore raw
Quoted 17 lines · Johan Hedberg

Hi Bastien,

Makefile.am endif · line 208

Quoted 7 lines · Bastien Nocera
Makefile.am +5 -0
+if HAL
 builtin_modules += hal
 builtin_sources += plugins/hal.c
+else
+builtin_modules += formfactor
+builtin_sources += plugins/formfactor.c
+endif

Previously it was possible to --disable-hal and be sure that whatever is defined in main.conf gets used (this is e.g. something that has been important for us in Maemo/MeeGo). Your patch seems to make one of the two automated adapter class sources always be used and so potentially overriding what main.conf says. So I'd prefer to keep the possibility of disably any such plugins completely.

Take a look at the code, there's no ways to disable the HAL plugin right now. If you want a separate patch for that, I can certainly cook one up.

#3 lore raw

Hi Bastien,

Quoted 9 lines · Bastien Nocera
Quoted 6 lines

Previously it was possible to --disable-hal and be sure that whatever is defined in main.conf gets used (this is e.g. something that has been important for us in Maemo/MeeGo). Your patch seems to make one of the two automated adapter class sources always be used and so potentially overriding what main.conf says. So I'd prefer to keep the possibility of disably any such plugins completely.

Take a look at the code, there's no ways to disable the HAL plugin right now. If you want a separate patch for that, I can certainly cook one up.

Yep, my memory was playing tricks on me here. We're actually using DisablePlugins=hal in main.conf to avoid interference from this code. The same would also work for your new plugin so build-time disabling isn't strictly necessary then (but might be nice to have for some platforms).

Johan

#4 lore raw
Quoted 10 lines · Johan Hedberg

Hi Bastien,

Quoted 7 lines · Bastien Nocera
Quoted 6 lines

Previously it was possible to --disable-hal and be sure that whatever is defined in main.conf gets used (this is e.g. something that has been important for us in Maemo/MeeGo). Your patch seems to make one of the two automated adapter class sources always be used and so potentially overriding what main.conf says. So I'd prefer to keep the possibility of disably any such plugins completely.

Quoted 8 lines
Quoted 2 lines

Take a look at the code, there's no ways to disable the HAL plugin right now. If you want a separate patch for that, I can certainly cook one up.

Yep, my memory was playing tricks on me here. We're actually using DisablePlugins=hal in main.conf to avoid interference from this code. The same would also work for your new plugin so build-time disabling isn't strictly necessary then (but might be nice to have for some platforms).

OK. Patch that actually applies to master attached. Was conflicting with another non-upstreamed patch.

Cheers

Quoted 1 line

From 6921ff03adcaea6e10dd926b8c9e3b9ec8842334 Mon Sep 17 00:00:00 2001

From: Bastien Nocera <[email protected]>
Date: Mon, 6 Sep 2010 11:44:31 +0100
Subject: [PATCH] Add new plugin to set adapter class

This time based on the kernel exported DMI, rather than calling out to HAL. The HAL plugin can still be preferred with --enable-hal=yes passed to configure.

---
 Makefile.am          |    7 ++
 acinclude.m4         |    7 ++-
 plugins/formfactor.c |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 1 deletions(-)
 create mode 100644 plugins/formfactor.c
Makefile.am +7 -0
index 9043d25..9a78780 100644
@@ -194,8 +194,15 @@ endif
 builtin_modules += hciops
 builtin_sources += plugins/hciops.c
 
+if HAL
 builtin_modules += hal
 builtin_sources += plugins/hal.c
+else
+builtin_modules += formfactor
+builtin_sources += plugins/formfactor.c
+endif
+
+EXTRA_DIST += plugins/hal.c plugins/formfactor.c
 
 builtin_modules += storage
 builtin_sources += plugins/storage.c
acinclude.m4 +6 -1
index dda965e..b34f08d 100644
@@ -158,7 +158,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	fortify_enable=yes
 	pie_enable=yes
 	sndfile_enable=${sndfile_found}
-	hal_enable=${hal_found}
+	hal_enable=no
 	usb_enable=${usb_found}
 	alsa_enable=${alsa_found}
 	gstreamer_enable=${gstreamer_found}
@@ -308,6 +308,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 		maemo6_enable=${enableval}
 	])
 
+	AC_ARG_ENABLE(hal, AC_HELP_STRING([--enable-hal], [Use HAL to determine adapter class]), [
+		hal_enable=${enableval}
+	])
+
 	if (test "${fortify_enable}" = "yes"); then
 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 	fi
@@ -341,6 +345,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
 	AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes")
 	AM_CONDITIONAL(MCAP, test "${mcap_enable}" = "yes")
+	AM_CONDITIONAL(HAL, test "${hal_enable}" = "yes")
 	AM_CONDITIONAL(ATTRIBPLUGIN, test "${attrib_enable}" = "yes")
 	AM_CONDITIONAL(ECHOPLUGIN, test "no" = "yes")
 	AM_CONDITIONAL(PNATPLUGIN, test "${pnat_enable}" = "yes")
plugins/formfactor.c new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
1.7.0.1
#5 lore raw

Hi Bastien,

Quoted 10 lines · Bastien Nocera

OK. Patch that actually applies to master attached. Was conflicting with another non-upstreamed patch.

From: Bastien Nocera <[email protected]>
Date: Mon, 6 Sep 2010 11:44:31 +0100
Subject: [PATCH] Add new plugin to set adapter class

This time based on the kernel exported DMI, rather than calling out to HAL. The HAL plugin can still be preferred with --enable-hal=yes passed to configure.

Quoted 6 lines
---
 Makefile.am          |    7 ++
 acinclude.m4         |    7 ++-
 plugins/formfactor.c |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 1 deletions(-)
 create mode 100644 plugins/formfactor.c

Thanks. The patch is now upstream.

Johan