hardinfo

Check-in [87d4c9c922]
Login

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

Overview
Comment:fix usb information display.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:87d4c9c9227a844670acbe30f358bf17d7801a55
User & Date: jamesbond 2014-08-05 00:08:52
Context
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
2014-07-28
17:01
revert commit [d5afcb6851]; fix the real cause of missing RAM display (use moreinfo_lookup rather than hi_more_info); fix usb display crashing (util.c now looks for lsusb in /usr/sbin first); fix glibc version not showing (glibc located in /lib64/libc.so.6); initial support for DDR3 spd-decoding (incomplete, the manufacturer is not shown yet). check-in: b571f0ca03 user: jamesbond tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/devices/usb.c.

244
245
246
247
248
249
250
251
252
253
254

255
256

257
258
259
260
261
262
263
264
265
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
...
315
316
317
318
319
320
321

322
323
324
325
326
327
328
    return n > 0;
}

void __scan_usb_lsusb_add_device(char *buffer, int bufsize, FILE *lsusb, int usb_device_number)
{
    gint bus, device, vendor_id, product_id;
    gchar *version = NULL, *product = NULL, *vendor = NULL, *dev_class = NULL, *int_class = NULL;
    gchar *max_power = NULL;
    gchar *tmp, *strhash;
    long position;


    sscanf(buffer, "Bus %d Device %d: ID %x:%x",
           &bus, &device, &vendor_id, &product_id);


    for (fgets(buffer, bufsize, lsusb); position = ftell(lsusb); fgets(buffer, bufsize, lsusb)) {
        g_strstrip(buffer);

        if (g_str_has_prefix(buffer, "idVendor")) {
            g_free(vendor);
            vendor = g_strdup(buffer + 26);
        } else if (g_str_has_prefix(buffer, "idProduct")) {
            g_free(product);
................................................................................
            dev_class = int_class;
        } else {
            dev_class = g_strdup("Unknown");
        }
    }

    tmp = g_strdup_printf("USB%d", usb_device_number);
    usb_list = h_strdup_cprintf("$%s$%s=\n", usb_list, tmp, product ? product : "Unknown");

    strhash = g_strdup_printf("[Device Information]\n"
			      "Product=%s\n"
			      "Manufacturer=%s\n"
			      "Max Current=%s\n"
			      "[Misc]\n"
			      "USB Version=%s\n"
................................................................................
    moreinfo_add_with_prefix("DEV", tmp, strhash);
    g_free(vendor);
    g_free(product);
    g_free(max_power);
    g_free(dev_class);
    g_free(version);
    g_free(tmp);

}

gboolean __scan_usb_lsusb(void)
{
    static gchar *lsusb_path = NULL;
    int usb_device_number = 0;
    FILE *lsusb;







|



>


>

|







 







|







 







>







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
    return n > 0;
}

void __scan_usb_lsusb_add_device(char *buffer, int bufsize, FILE *lsusb, int usb_device_number)
{
    gint bus, device, vendor_id, product_id;
    gchar *version = NULL, *product = NULL, *vendor = NULL, *dev_class = NULL, *int_class = NULL;
    gchar *max_power = NULL, *name=NULL;
    gchar *tmp, *strhash;
    long position;

	g_strstrip(buffer);
    sscanf(buffer, "Bus %d Device %d: ID %x:%x",
           &bus, &device, &vendor_id, &product_id);
	name = g_strdup (buffer + 33); 

    for (fgets(buffer, bufsize, lsusb); fgets(buffer, bufsize, lsusb); position = ftell(lsusb)) {
        g_strstrip(buffer);

        if (g_str_has_prefix(buffer, "idVendor")) {
            g_free(vendor);
            vendor = g_strdup(buffer + 26);
        } else if (g_str_has_prefix(buffer, "idProduct")) {
            g_free(product);
................................................................................
            dev_class = int_class;
        } else {
            dev_class = g_strdup("Unknown");
        }
    }

    tmp = g_strdup_printf("USB%d", usb_device_number);
    usb_list = h_strdup_cprintf("$%s$%s=\n", usb_list, tmp, name);

    strhash = g_strdup_printf("[Device Information]\n"
			      "Product=%s\n"
			      "Manufacturer=%s\n"
			      "Max Current=%s\n"
			      "[Misc]\n"
			      "USB Version=%s\n"
................................................................................
    moreinfo_add_with_prefix("DEV", tmp, strhash);
    g_free(vendor);
    g_free(product);
    g_free(max_power);
    g_free(dev_class);
    g_free(version);
    g_free(tmp);
    g_free(name);
}

gboolean __scan_usb_lsusb(void)
{
    static gchar *lsusb_path = NULL;
    int usb_device_number = 0;
    FILE *lsusb;