[gnome-battery-bench] util: Auto detect base in sysfs_read_guint64



commit 5f6c5e4e59615987ef1736b8de3cae1c94c9f139
Author: Christian Kellner <gicmo gnome org>
Date:   Wed Jun 7 10:00:49 2017 +0200

    util: Auto detect base in sysfs_read_guint64
    
    Fix a integration test where a sysfs value starts does not work
    with base autodetection.

 src/integration-test |    2 +-
 src/util-sysfs.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/integration-test b/src/integration-test
index b50b4b8..332abc9 100755
--- a/src/integration-test
+++ b/src/integration-test
@@ -361,7 +361,7 @@ class Tests(unittest.TestCase):
 
         self.assertIn('Monitoring power events', log)
 
-        self.testbed.set_attribute(b0, 'energy_now', '09000000')
+        self.testbed.set_attribute(b0, 'energy_now', '9000000')
         self.assertIn('20.00 WH', log)
 
         self.testbed.set_attribute(b1, 'energy_now', '10000000')
diff --git a/src/util-sysfs.c b/src/util-sysfs.c
index d6cbd46..392acfb 100644
--- a/src/util-sysfs.c
+++ b/src/util-sysfs.c
@@ -34,7 +34,7 @@ sysfs_read_guint64(GUdevDevice *device, const char *name, guint64 *res)
         return FALSE;
     }
 
-    value = g_ascii_strtoull(buffer, &end, 10);
+    value = g_ascii_strtoull(buffer, &end, 0);
     if (end == buffer) {
         return FALSE;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]