From 5f620001a8f9017449d15b1a4aafdb9a61a44d4d Mon Sep 17 00:00:00 2001 From: Ondrej Čerman Date: Sat, 20 Jul 2019 23:07:56 +0200 Subject: usb: added info from sysfs --- hardinfo/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'hardinfo/util.c') diff --git a/hardinfo/util.c b/hardinfo/util.c index 964617d4..c8c99224 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -1237,6 +1237,22 @@ h_sysfs_read_int(const gchar *endpoint, const gchar *entry) return return_value; } +gint +h_sysfs_read_hex(const gchar *endpoint, const gchar *entry) +{ + gchar *tmp, *buffer; + gint return_value = 0; + + tmp = g_build_filename(endpoint, entry, NULL); + if (g_file_get_contents(tmp, &buffer, NULL, NULL)) + return_value = (gint) strtoll(buffer, NULL, 16); + + g_free(tmp); + g_free(buffer); + + return return_value; +} + gchar * h_sysfs_read_string(const gchar *endpoint, const gchar *entry) { -- cgit v1.2.3