summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@web.de>2009-02-02 18:16:39 +0100
committerDanny Kukawka <danny.kukawka@web.de>2009-02-02 18:16:39 +0100
commit9ff3ffe362c2d72a393aa4cde5c94950e26aeac7 (patch)
tree266338804a18eb241e78914268b470892b1e567a
parente04a7138ac2de0917e0032dae7bdfc1c2dabc179 (diff)
provide comparable linux kernel version information
Provide comparable linux kernel version information via these new properties: system.kernel.version.major (int) system.kernel.version.minor (int) system.kernel.version.micro (int) This allow us to track changes in the kernel within the fdi files and rules.
-rw-r--r--doc/spec/hal-spec-properties.xml24
-rw-r--r--hald/linux/osspec.c11
2 files changed, 35 insertions, 0 deletions
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 3c400efe..d06e9704 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7027,6 +7027,30 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
</row>
<row>
<entry>
+ <literal>system.kernel.version.major</literal> (int)
+ </entry>
+ <entry>example: 2</entry>
+ <entry>No</entry>
+ <entry>The major version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>system.kernel.version.minor</literal> (int)
+ </entry>
+ <entry>example: 6</entry>
+ <entry>No</entry>
+ <entry>The minor version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>system.kernel.version.micro</literal> (int)
+ </entry>
+ <entry>example: 28</entry>
+ <entry>No</entry>
+ <entry>The micro version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
<literal>system.kernel.machine</literal> (string)
</entry>
<entry>example: i686</entry>
diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index f75d88a9..16ee2529 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -840,6 +840,17 @@ osspec_probe (void)
if (uname (&un) >= 0) {
hal_device_property_set_string (root, "system.kernel.name", un.sysname);
hal_device_property_set_string (root, "system.kernel.version", un.release);
+ if (un.release != NULL && un.release[0] != '\0') {
+ int major, minor, micro ;
+
+ /* check if we can parse the major.minor.micro info and ignore the rest */
+ if ( sscanf( un.release, "%d.%d.%d", &major, &minor, &micro ) >= 3 ) {
+ hal_device_property_set_int (root, "system.kernel.version.major", major);
+ hal_device_property_set_int (root, "system.kernel.version.minor", minor);
+ hal_device_property_set_int (root, "system.kernel.version.micro", micro);
+ }
+ }
+
hal_device_property_set_string (root, "system.kernel.machine", un.machine);
}