panel: added sysfs support
PATCH 1/1 panel: added sysfs support
battery applet supports reading battery and supply information from sysfs entries, /sys/class/power_supply/.
Signed-off-by Dixit Parmar <[email protected]>
--- applets/battery/Makefile.am | 4 + applets/battery/battery-sysfs.c | 153 ++++++++++++++++++++++++++++++++ applets/battery/battery.h | 5 +- configure.ac | 4 + 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 applets/battery/battery-sysfs.c
applets/battery/Makefile.am +4 -0
@@ -5,6 +5,10 @@ applet_LTLIBRARIES = libbattery.la libbattery_la_SOURCES = battery.c battery.h libbattery_la_CPPFLAGS = $(AM_CPPFLAGS) -DDATADIR=\"$(pkgdatadir)/battery/\" +if HAVE_SYSFS +libbattery_la_SOURCES += battery-sysfs.c +endif + if HAVE_LIBAPM libbattery_la_LIBADD = -lapm libbattery_la_SOURCES += battery-apm.c
applets/battery/battery-sysfs.c new file +153 -0
153 lines not on this page · raw message
applets/battery/battery.h +4 -1
@@ -6,8 +6,11 @@#ifndef MB_APPLET_BATTERY_H #define MB_APPLET_BATTERY_H - +#include <stdio.h> #include <string.h> +#include <stdlib.h> +#include <sys/types.h> +#include <dirent.h> int pm_support (void );const char *pm_battery_icon (void );
configure.ac +4 -0
@@ -61,6 +61,9 @@ AC_ARG_WITH( ) case "$with_battery" in + "sysfs") enable_linux_sysfs=yes + enable_battery=yes + ;; "acpi") AC_CHECK_HEADERS(libacpi.h, enable_linux_acpi=yes, AC_MSG_FAILURE([You need to install libacpi])) enable_battery=yes ;;
@@ -75,6 +78,7 @@ esac AM_CONDITIONAL(HAVE_BATTERY, test x$enable_battery = xyes) AM_CONDITIONAL(HAVE_LIBAPM, test x$enable_linux_apm = xyes) AM_CONDITIONAL(HAVE_LIBACPI, test x$enable_linux_acpi = xyes) +AM_CONDITIONAL(HAVE_SYSFS, test x$enable_linux_sysfs = xyes) # glib-genmarshal GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
Signature · 1 line
2.43.0
Hi Dixit,
Quoted 35 lines · Dixit Parmar via lists.yoctoproject.org
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
battery applet supports reading battery and supply information from sysfs entries,
/sys/class/power_supply/.Signed-off-by Dixit Parmar <[email protected]>--- applets/battery/Makefile.am | 4 + applets/battery/battery-sysfs.c | 153 ++++++++++++++++++++++++++++++++ applets/battery/battery.h | 5 +- configure.ac | 4 + 4 files changed, 165 insertions(+), 1 deletion(-)create mode 100644
applets/battery/battery-sysfs.capplets/battery/Makefile.am +4
-0@@ -5,6 +5,10 @@ applet_LTLIBRARIES = libbattery.la libbattery_la_SOURCES = battery.c battery.h libbattery_la_CPPFLAGS = $(AM_CPPFLAGS) -DDATADIR=\"$(pkgdatadir)/battery/\" +if HAVE_SYSFS +libbattery_la_SOURCES += battery-sysfs.c +endif + if HAVE_LIBAPM libbattery_la_LIBADD = -lapm libbattery_la_SOURCES += battery-apm.capplets/battery/battery-sysfs.c new file +0
-0
applets/battery/battery-sysfs.c line 6
Quoted 6 lines
applets/battery/battery-sysfs.c new file +6
-0@@ -0,0 +1,153 @@ +/* +* (C) 2008 Intel. +* +* Licensed under the GPL v2 or greater. +*/ +
From where is this file imported? Could you add this information to the commit message?
This is a bit of an unconventional way to word "GPLv2+".
Cheers,
Quentin