hardinfo

Check-in [b699f12863]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:update sensors.c to work with kernel 3.18.x
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b699f12863a195851a5b23b1e16d48edf6ef4592
User & Date: jamesbond 2015-02-13 04:33:52
Context
2015-02-19
07:18
sensors.c: read sensors from sys/thermal, also fix read_sensors_hwmon to read both from /sys/class/hwmon and /sys/class/hwmon/device. check-in: e53cf0fadd user: jamesbond tags: trunk
2015-02-13
04:33
update sensors.c to work with kernel 3.18.x check-in: b699f12863 user: jamesbond tags: trunk
2014-08-05
00:08
fix usb information display. check-in: 87d4c9c922 user: jamesbond tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/devices/sensors.c.

150
151
152
153
154
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    return math_postfix_eval(postfix, value);
}

static char *get_sensor_path(int number)
{
    char *path, *last_slash;

    path = g_strdup_printf("/sys/class/hwmon/hwmon%d/device", number);
    if (g_file_test(path, G_FILE_TEST_EXISTS)) {
        return path;
    }


    if ((last_slash = strrchr(path, '/'))) {
        *last_slash = '\0';
        return path;
    }

    g_free(path);
    return NULL;
}

static char *determine_driver_for_hwmon_path(char *path)
{
    char *tmp, *driver;

    tmp = g_strdup_printf("%s/driver", path);
    driver = g_file_read_link(tmp, NULL);
    g_free(tmp);

    if (driver) {
        tmp = g_path_get_basename(driver);
        g_free(driver);
        driver = tmp;







|
|


<
>




|








|







150
151
152
153
154
155
156
157
158
159
160

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    return math_postfix_eval(postfix, value);
}

static char *get_sensor_path(int number)
{
    char *path, *last_slash;

    path = g_strdup_printf("/sys/class/hwmon/hwmon%d", number);
    if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
        return path;
    }

/*  we start at the top of hwmon, this fallback is not needed anymore
    if ((last_slash = strrchr(path, '/'))) {
        *last_slash = '\0';
        return path;
    }
*/
    g_free(path);
    return NULL;
}

static char *determine_driver_for_hwmon_path(char *path)
{
    char *tmp, *driver;

    tmp = g_strdup_printf("%s/device/driver", path);
    driver = g_file_read_link(tmp, NULL);
    g_free(tmp);

    if (driver) {
        tmp = g_path_get_basename(driver);
        g_free(driver);
        driver = tmp;