summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}