diff mbox

[28/30] package/matchbox-panel: add option to use ACPI for the battery applet

Message ID cbb90f6326af77c2c466fa72ee970fee6a9040f1.1429725549.git.yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN April 22, 2015, 6:09 p.m. UTC
It is possible to use ACPI to monitor the battery with the battery
min-applet. If ACPI is not explicitly enabled, then APM is used if
available; if ACPI is not explcitly enabled and APM is not available,
then the battery applet id not built.

What is a pity is that there is no way to explicitly enable or disable
the applet; it only relies on auto-detection... :-(

So, add an option to enable use of ACPI, visible only on architectures
that have at least some hope of having ACPI support.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/matchbox/matchbox-panel/Config.in         | 15 +++++++++++++++
 package/matchbox/matchbox-panel/matchbox-panel.mk |  6 ++++++
 2 files changed, 21 insertions(+)

Comments

Arnout Vandecappelle May 1, 2015, 9:39 p.m. UTC | #1
On 22/04/15 20:09, Yann E. MORIN wrote:
> It is possible to use ACPI to monitor the battery with the battery
> min-applet. If ACPI is not explicitly enabled, then APM is used if
> available; if ACPI is not explcitly enabled and APM is not available,
> then the battery applet id not built.
> 
> What is a pity is that there is no way to explicitly enable or disable
> the applet; it only relies on auto-detection... :-(
> 
> So, add an option to enable use of ACPI, visible only on architectures
> that have at least some hope of having ACPI support.

 Since APM exists only on x86, there is basically no way to disable the applet
on x86. The only thing that the configure option does is to force the applet to
use the deprecated and most likely unavailable APM interface.

 Therefore, I'd remove the Config.in option and just pass --enable-acpi-linux
unconditionally on x86 and aarch64. The worst that can happen is that you build
a tiny applet that turns out not to work.

 That said, the applet doesn't build for me (with Sourcery x86_64 toolchain)
because the 'line_parse' inner function is declared static...


 Regards,
 Arnout

> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/matchbox/matchbox-panel/Config.in         | 15 +++++++++++++++
>  package/matchbox/matchbox-panel/matchbox-panel.mk |  6 ++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/package/matchbox/matchbox-panel/Config.in b/package/matchbox/matchbox-panel/Config.in
> index 47bd10a..93241f0 100644
> --- a/package/matchbox/matchbox-panel/Config.in
> +++ b/package/matchbox/matchbox-panel/Config.in
> @@ -4,3 +4,18 @@ config BR2_PACKAGE_MATCHBOX_PANEL
>  	help
>  	  A flexible always present 'window bar' for holding
>  	  application launchers.
> +
> +if BR2_PACKAGE_MATCHBOX_PANEL
> +
> +config BR2_PACKAGE_MATCHBOX_PANEL_ACPI
> +	bool "use ACPI for battery mini-applet"
> +	depends on BR2_i386 || BR2_x86_64 || BR2_aarch64
> +	help
> +	  Use ACPI to monitor the battery.
> +
> +	  Say 'y' here to use ACPI to monitor the battery.
> +	  If you say 'n', then APM will be used if available;
> +	  otherwise the battery monitor mini-applet is not
> +	  built.
> +
> +endif # BR2_PACKAGE_MATCHBOX_PANEL
> diff --git a/package/matchbox/matchbox-panel/matchbox-panel.mk b/package/matchbox/matchbox-panel/matchbox-panel.mk
> index f7d699b..aa9018c 100644
> --- a/package/matchbox/matchbox-panel/matchbox-panel.mk
> +++ b/package/matchbox/matchbox-panel/matchbox-panel.mk
> @@ -20,6 +20,12 @@ else
>  MATCHBOX_PANEL_CONF_OPTS += --disable-startup-notification
>  endif
>  
> +ifeq ($(BR2_PACKAGE_MATCHBOX_PANEL_ACPI),y)
> +MATCHBOX_PANEL_CONF_OPTS += --enable-acpi-linux
> +else
> +MATCHBOX_PANEL_CONF_OPTS += --disable-acpi-linux
> +endif
> +
>  ifeq ($(BR2_PACKAGE_WIRELESS_TOOLS),y)
>  MATCHBOX_PANEL_DEPENDENCIES += wireless_tools
>  endif
>
Yann E. MORIN May 2, 2015, 3:22 p.m. UTC | #2
Arnout, All,

On 2015-05-01 23:39 +0200, Arnout Vandecappelle spake thusly:
> On 22/04/15 20:09, Yann E. MORIN wrote:
> > It is possible to use ACPI to monitor the battery with the battery
> > min-applet. If ACPI is not explicitly enabled, then APM is used if
> > available; if ACPI is not explcitly enabled and APM is not available,
> > then the battery applet id not built.
> > 
> > What is a pity is that there is no way to explicitly enable or disable
> > the applet; it only relies on auto-detection... :-(
> > 
> > So, add an option to enable use of ACPI, visible only on architectures
> > that have at least some hope of having ACPI support.
> 
>  Since APM exists only on x86, there is basically no way to disable the applet
> on x86. The only thing that the configure option does is to force the applet to
> use the deprecated and most likely unavailable APM interface.
> 
>  Therefore, I'd remove the Config.in option and just pass --enable-acpi-linux
> unconditionally on x86 and aarch64. The worst that can happen is that you build
> a tiny applet that turns out not to work.

Ok, done: ACPI forcibly used on supported platforms.

>  That said, the applet doesn't build for me (with Sourcery x86_64 toolchain)
> because the 'line_parse' inner function is declared static...

Weird, itworked for me, but with another toolchain. Fixed.

Regards,
Yann E. MORIN.

> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  package/matchbox/matchbox-panel/Config.in         | 15 +++++++++++++++
> >  package/matchbox/matchbox-panel/matchbox-panel.mk |  6 ++++++
> >  2 files changed, 21 insertions(+)
> > 
> > diff --git a/package/matchbox/matchbox-panel/Config.in b/package/matchbox/matchbox-panel/Config.in
> > index 47bd10a..93241f0 100644
> > --- a/package/matchbox/matchbox-panel/Config.in
> > +++ b/package/matchbox/matchbox-panel/Config.in
> > @@ -4,3 +4,18 @@ config BR2_PACKAGE_MATCHBOX_PANEL
> >  	help
> >  	  A flexible always present 'window bar' for holding
> >  	  application launchers.
> > +
> > +if BR2_PACKAGE_MATCHBOX_PANEL
> > +
> > +config BR2_PACKAGE_MATCHBOX_PANEL_ACPI
> > +	bool "use ACPI for battery mini-applet"
> > +	depends on BR2_i386 || BR2_x86_64 || BR2_aarch64
> > +	help
> > +	  Use ACPI to monitor the battery.
> > +
> > +	  Say 'y' here to use ACPI to monitor the battery.
> > +	  If you say 'n', then APM will be used if available;
> > +	  otherwise the battery monitor mini-applet is not
> > +	  built.
> > +
> > +endif # BR2_PACKAGE_MATCHBOX_PANEL
> > diff --git a/package/matchbox/matchbox-panel/matchbox-panel.mk b/package/matchbox/matchbox-panel/matchbox-panel.mk
> > index f7d699b..aa9018c 100644
> > --- a/package/matchbox/matchbox-panel/matchbox-panel.mk
> > +++ b/package/matchbox/matchbox-panel/matchbox-panel.mk
> > @@ -20,6 +20,12 @@ else
> >  MATCHBOX_PANEL_CONF_OPTS += --disable-startup-notification
> >  endif
> >  
> > +ifeq ($(BR2_PACKAGE_MATCHBOX_PANEL_ACPI),y)
> > +MATCHBOX_PANEL_CONF_OPTS += --enable-acpi-linux
> > +else
> > +MATCHBOX_PANEL_CONF_OPTS += --disable-acpi-linux
> > +endif
> > +
> >  ifeq ($(BR2_PACKAGE_WIRELESS_TOOLS),y)
> >  MATCHBOX_PANEL_DEPENDENCIES += wireless_tools
> >  endif
> > 
> 
> 
> -- 
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
diff mbox

Patch

diff --git a/package/matchbox/matchbox-panel/Config.in b/package/matchbox/matchbox-panel/Config.in
index 47bd10a..93241f0 100644
--- a/package/matchbox/matchbox-panel/Config.in
+++ b/package/matchbox/matchbox-panel/Config.in
@@ -4,3 +4,18 @@  config BR2_PACKAGE_MATCHBOX_PANEL
 	help
 	  A flexible always present 'window bar' for holding
 	  application launchers.
+
+if BR2_PACKAGE_MATCHBOX_PANEL
+
+config BR2_PACKAGE_MATCHBOX_PANEL_ACPI
+	bool "use ACPI for battery mini-applet"
+	depends on BR2_i386 || BR2_x86_64 || BR2_aarch64
+	help
+	  Use ACPI to monitor the battery.
+
+	  Say 'y' here to use ACPI to monitor the battery.
+	  If you say 'n', then APM will be used if available;
+	  otherwise the battery monitor mini-applet is not
+	  built.
+
+endif # BR2_PACKAGE_MATCHBOX_PANEL
diff --git a/package/matchbox/matchbox-panel/matchbox-panel.mk b/package/matchbox/matchbox-panel/matchbox-panel.mk
index f7d699b..aa9018c 100644
--- a/package/matchbox/matchbox-panel/matchbox-panel.mk
+++ b/package/matchbox/matchbox-panel/matchbox-panel.mk
@@ -20,6 +20,12 @@  else
 MATCHBOX_PANEL_CONF_OPTS += --disable-startup-notification
 endif
 
+ifeq ($(BR2_PACKAGE_MATCHBOX_PANEL_ACPI),y)
+MATCHBOX_PANEL_CONF_OPTS += --enable-acpi-linux
+else
+MATCHBOX_PANEL_CONF_OPTS += --disable-acpi-linux
+endif
+
 ifeq ($(BR2_PACKAGE_WIRELESS_TOOLS),y)
 MATCHBOX_PANEL_DEPENDENCIES += wireless_tools
 endif