Hi all, Attaching some patches that 1.) adds Info abstract Interface to libfsoframework 2.) Fixes a build errors due to the missing posix.vapi inclusion 3.) Add Info plugin that implements org.freesmartphone.Device.Info (The proc node was hardcoded. Should it be a configuration file entry?)
Not sure if its me, but I keep getting errors with regards to missing stropts.h on a fedora 64 bit installation. If anyone is getting this, please let me know. Thanks -- Regards Sudharshan S Blog : http://www.sudharsh.wordpress.com IRC : Sup3rkiddo @ Freenode, Gimpnet
From 689c91cb5f380975dab2a2bb688497a9f12346bf Mon Sep 17 00:00:00 2001 From: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> Date: Sun, 12 Apr 2009 21:34:39 +0530 Subject: [PATCH] Add Info Interface Signed-off-by: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> --- libfsoframework/fsoframework/interfaces.vala | 31 ++++++++++++++++--------- 1 files changed, 20 insertions(+), 11 deletions(-) diff --git a/libfsoframework/fsoframework/interfaces.vala b/libfsoframework/fsoframework/interfaces.vala index 07e86a9..fae30c3 100644 --- a/libfsoframework/fsoframework/interfaces.vala +++ b/libfsoframework/fsoframework/interfaces.vala @@ -33,8 +33,11 @@ namespace FsoFramework public const string LedServiceFace = ServiceFacePrefix + ".LED"; public const string LedServicePath = ServicePathPrefix + "/LED"; - public const string DisplayServiceFace = ServiceFacePrefix + ".Display"; - public const string DisplayServicePath = ServicePathPrefix + "/Display"; + public const string DisplayServiceFace = ServiceFacePrefix + ".Display"; + public const string DisplayServicePath = ServicePathPrefix + "/Display"; + + public const string InfoServiceFace = ServiceFacePrefix + ".Info"; + public const string InfoServicePath = ServicePathPrefix + "/Info"; [DBus (name = "org.freesmartphone.Device.LED")] @@ -46,14 +49,20 @@ namespace FsoFramework public abstract void SetNetworking( string iface, string mode ) throws DBus.Error; } - [DBus (name = "org.freesmartphone.Device.Display")] - public abstract interface Display : GLib.Object - { - public abstract void SetBrightness(int brightness); - public abstract int GetBrightness(); - public abstract bool GetBacklightPower(); - public abstract void SetBacklightPower(bool power); - public abstract HashTable<string, Value?> GetInfo(); - } + [DBus (name = "org.freesmartphone.Device.Display")] + public abstract interface Display : GLib.Object + { + public abstract void SetBrightness(int brightness); + public abstract int GetBrightness(); + public abstract bool GetBacklightPower(); + public abstract void SetBacklightPower(bool power); + public abstract HashTable<string, Value?> GetInfo(); + } + + [DBus (name = "org.freesmartphone.Device.Info")] + public abstract interface Info : GLib.Object + { + public abstract HashTable<string, Value?> GetCpuInfo(); + } } } -- 1.6.0.6
From 69eb5d16f3fdb487a1ca7f98e1824037c6b325e6 Mon Sep 17 00:00:00 2001 From: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> Date: Sun, 12 Apr 2009 22:37:48 +0530 Subject: [PATCH] Fix a build error due to missing package inclusion Signed-off-by: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> --- fsodeviced/src/plugins/kernel26_leds/Makefile.am | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fsodeviced/src/plugins/kernel26_leds/Makefile.am b/fsodeviced/src/plugins/kernel26_leds/Makefile.am index eafdced..d71d37f 100644 --- a/fsodeviced/src/plugins/kernel26_leds/Makefile.am +++ b/fsodeviced/src/plugins/kernel26_leds/Makefile.am @@ -15,6 +15,7 @@ VALAC_ARGS = \ --vapidir $(top_srcdir)/fsoframework \ --pkg glib-2.0 \ --pkg dbus-glib-1 \ + --pkg posix \ --pkg fsoframework-2.0 # -- 1.6.0.6
From e54a592d070ae7b73722d90af3300758e19c23d0 Mon Sep 17 00:00:00 2001 From: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> Date: Sun, 12 Apr 2009 22:39:22 +0530 Subject: [PATCH] Add Info plugin Signed-off-by: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com> --- fsodeviced/configure.ac | 1 + fsodeviced/src/plugins/Makefile.am | 1 + fsodeviced/src/plugins/info/Makefile.am | 47 ++++++++++++++++ fsodeviced/src/plugins/info/plugin.vala | 92 +++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 0 deletions(-) create mode 100644 fsodeviced/src/plugins/info/Makefile.am create mode 100644 fsodeviced/src/plugins/info/plugin.vala diff --git a/fsodeviced/configure.ac b/fsodeviced/configure.ac index 538a359..793dc49 100644 --- a/fsodeviced/configure.ac +++ b/fsodeviced/configure.ac @@ -54,6 +54,7 @@ AC_CONFIG_FILES([ src/plugins/Makefile src/plugins/kernel26_leds/Makefile src/plugins/kernel26_display/Makefile + src/plugins/info/Makefile tests/Makefile ]) diff --git a/fsodeviced/src/plugins/Makefile.am b/fsodeviced/src/plugins/Makefile.am index d03c4e1..d45f3ac 100644 --- a/fsodeviced/src/plugins/Makefile.am +++ b/fsodeviced/src/plugins/Makefile.am @@ -5,4 +5,5 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = \ kernel26_leds \ kernel26_display \ + info \ $(NULL) diff --git a/fsodeviced/src/plugins/info/Makefile.am b/fsodeviced/src/plugins/info/Makefile.am new file mode 100644 index 0000000..8232fea --- /dev/null +++ b/fsodeviced/src/plugins/info/Makefile.am @@ -0,0 +1,47 @@ +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(FSO_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(NULL) + +noinst_PROGRAMS = $(TEST_PROGS) + +progs_ldadd = $(FSO_LIBS) $(DBUS_LIBS) $(top_srcdir)/src/lib/libfsodevice.la + +VALAC_ARGS = \ + --basedir $(top_srcdir) \ + --vapidir $(top_srcdir)/fsoframework \ + --pkg glib-2.0 \ + --pkg dbus-glib-1 \ + --pkg gio-2.0 \ + --pkg fsoframework-2.0 \ + --pkg posix + + + +# +# plugin +# +modlibexecdir = $(libdir)/cornucopia/modules/fsodevice +modlibexec_LTLIBRARIES = info.la +info_la_SOURCES = plugin.c plugin.h +info_la_VALASOURCES = plugin.vala +$(info_la_SOURCES): $(info_la_VALASOURCES) + $(VALAC) -C $(VALAC_ARGS) $^ + touch $@ +info_la_LIBADD = $(progs_ldadd) +info_la_LDFLAGS = -no-undefined -module -avoid-version +info_la_LIBTOOLFLAGS = --tag=disable-static00 + +CLEANFILES = \ + *.c \ + *.h \ + *.la \ + *.lo \ + $(NULL) + +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(NULL) diff --git a/fsodeviced/src/plugins/info/plugin.vala b/fsodeviced/src/plugins/info/plugin.vala new file mode 100644 index 0000000..c034c4d --- /dev/null +++ b/fsodeviced/src/plugins/info/plugin.vala @@ -0,0 +1,92 @@ +/* + * plugin.vala + * Written by Sudharshan "Sup3rkiddo" S <sudha...@gmail.com> + * All Rights Reserved + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +using GLib; + +class Info : FsoFramework.Device.Info, FsoFramework.AbstractObject +{ + + private FsoFramework.Subsystem subsystem; + private const string PROC_NODE = "/proc/cpuinfo"; + + public Info( FsoFramework.Subsystem subsystem ) + { + this.subsystem = subsystem; + subsystem.registerServiceName( FsoFramework.Device.ServiceDBusName ); + subsystem.registerServiceObject( FsoFramework.Device.ServiceDBusName, + FsoFramework.Device.InfoServicePath, + this ); + logger.info( "Created Info plugin @ %s".printf( FsoFramework.Device.InfoServicePath ) ); + } + + + public override string repr() + { + return "<FsoFramework.Device.Info @ %s>".printf( FsoFramework.Device.InfoServicePath ); + } + + + public HashTable<string, Value?> GetCpuInfo() + { + File node_file = File.new_for_path( PROC_NODE ); + string line = new string(); + var val = Value( typeof(string) ); + HashTable<string, Value?> _ret = new HashTable<string, Value?> ( (HashFunc)str_hash, + (EqualFunc)str_equal ); + DataInputStream stream = new DataInputStream( node_file.read(null) ); + try + { + line = stream.read_line( null, null ); + while (( line = stream.read_line( null, null ) ) != null) + { + if ( line == "\n" || line == "" ) + continue; + + string[] _list = line.split(":"); + if ( (_list[1] != "") && (_list[0] != "") ) + { + val.take_string(_list[1].strip()); + _ret.insert ( _list[0].strip(), val ); + } + } + } + catch (GLib.Error error) { + logger.warning( error.message ); + } + return _ret; + } + +} + + +Info instance; +public static string fso_factory_function( FsoFramework.Subsystem subsystem ) throws Error +{ + instance = new Info( subsystem ); + return "fsodevice.info"; +} + + +[ModuleInit] +public static void fso_register_function( TypeModule module ) +{ + debug( "kernel26_info fso_register_function()" ); +} -- 1.6.0.6
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Smartphones-userland mailing list Smartphones-userland@linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-userland