hardinfo

Check-in [b571f0ca03]
Login

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

Overview
Comment: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).
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b571f0ca0360649f96033aacb7ee04b6c8b0dd6e
User & Date: jamesbond 2014-07-28 17:01:25
Context
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
2014-06-06
19:59
os database: Fatdog has to come before Puppy Linux as it shares some files with Puppy, otherwise Fatdog will be detected as Puppy Linux. check-in: b13faa87f3 user: jamesbond tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to hardinfo/util.c.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
void sync_manager_clear_entries(void);

gchar *find_program(gchar *program_name)
{
    int i;
    char *temp;
    static GHashTable *cache = NULL;
    const char *path[] = { "/bin", "/sbin",
		           "/usr/bin", "/usr/sbin",
		           "/usr/local/bin", "/usr/local/sbin",
		           NULL };
    
    /* we don't need to call stat() every time: cache the results */
    if (!cache) {
    	cache = g_hash_table_new(g_str_hash, g_str_equal);
    } else if ((temp = g_hash_table_lookup(cache, program_name))) {
    	return g_strdup(temp);
    }







|
|
|
|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
void sync_manager_clear_entries(void);

gchar *find_program(gchar *program_name)
{
    int i;
    char *temp;
    static GHashTable *cache = NULL;
    const char *path[] = { "/usr/local/bin", "/usr/local/sbin",
		                   "/usr/bin", "/usr/sbin",
		                   "/bin", "/sbin",
		                   NULL };
    
    /* we don't need to call stat() every time: cache the results */
    if (!cache) {
    	cache = g_hash_table_new(g_str_hash, g_str_equal);
    } else if ((temp = g_hash_table_lookup(cache, program_name))) {
    	return g_strdup(temp);
    }

Changes to modules/computer.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    {N_("Groups"), "users.png", callback_groups, scan_groups, MODULE_FLAG_NONE},
    {NULL},
};

gchar *module_list = NULL;
Computer *computer = NULL;

static gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("COMP", entry);

    if (info)
	return g_strdup(info);

    return g_strdup_printf("[%s]", entry);







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    {N_("Groups"), "users.png", callback_groups, scan_groups, MODULE_FLAG_NONE},
    {NULL},
};

gchar *module_list = NULL;
Computer *computer = NULL;

gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("COMP", entry);

    if (info)
	return g_strdup(info);

    return g_strdup_printf("[%s]", entry);

Changes to modules/computer/os.c.

22
23
24
25
26
27
28





29

30


31
32

33
34
35
36
37
38
39
40
41
42
43
#include "computer.h"

static gchar *
get_libc_version(void)
{
    FILE *libc;
    gchar buf[256], *tmp, *p;







    if (g_file_test("/lib/ld-uClibc.so.0", G_FILE_TEST_EXISTS)) {


      return g_strdup("uClibc Library");
    } else if (!g_file_test("/lib/libc.so.6", G_FILE_TEST_EXISTS)) {

      goto err;
    }

    libc = popen("/lib/libc.so.6", "r");
    if (!libc) goto err;

    (void)fgets(buf, 256, libc);
    if (pclose(libc)) goto err;

    tmp = strstr(buf, "version ");
    if (!tmp) goto err;







>
>
>
>
>
|
>
|
>
>
|
<
>
|
|

|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
#include "computer.h"

static gchar *
get_libc_version(void)
{
    FILE *libc;
    gchar buf[256], *tmp, *p;
    char *libc_paths[] = {
		"/lib/ld-uClibc.so.0", "/lib64/ld-uClibc.so.0",
		"/lib/libc.so.6", "/lib64/libc.so.6"
	};
	int i;
	
	for (i=0; i < 4; i++) {
		if (g_file_test(libc_paths[i], G_FILE_TEST_EXISTS)) break;
	}
	switch (i) {
		case 0: case 1: return g_strdup("uClibc Library");

		case 2: case 3: break; // gnu libc, continue processing
		default: goto err;
	}

    libc = popen(libc_paths[i], "r");
    if (!libc) goto err;

    (void)fgets(buf, 256, libc);
    if (pclose(libc)) goto err;

    tmp = strstr(buf, "version ");
    if (!tmp) goto err;

Changes to modules/devices.c.

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
void scan_usb(gboolean reload);
#if defined(ARCH_x86) || defined(ARCH_x86_64)
void scan_dmi(gboolean reload);
void scan_spd(gboolean reload);
#endif
void scan_device_resources(gboolean reload);

static gchar *hi_more_info(gchar *entry);

static ModuleEntry entries[] = {
    {N_("Processor"), "processor.png", callback_processors, scan_processors, MODULE_FLAG_NONE},
    {N_("Memory"), "memory.png", callback_memory, scan_memory, MODULE_FLAG_NONE},
    {N_("PCI Devices"), "devices.png", callback_pci, scan_pci, MODULE_FLAG_NONE},
    {N_("USB Devices"), "usb.png", callback_usb, scan_usb, MODULE_FLAG_NONE},
    {N_("Printers"), "printer.png", callback_printers, scan_printers, MODULE_FLAG_NONE},
................................................................................
    
    return NULL;
}

gchar *get_memory_total(void)
{
    scan_memory(FALSE);
    return hi_more_info(N_("Total Memory"));    
}

gchar *get_motherboard(void)
{
    char *board_name, *board_vendor;

    scan_dmi(FALSE);
................................................................................
	{"getMotherboard", get_motherboard},
	{NULL}
    };

    return m;
}

static gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("DEV", entry);
    
    if (info)
	return g_strdup(info);

    return g_strdup("?");







|







 







|







 







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
void scan_usb(gboolean reload);
#if defined(ARCH_x86) || defined(ARCH_x86_64)
void scan_dmi(gboolean reload);
void scan_spd(gboolean reload);
#endif
void scan_device_resources(gboolean reload);

gchar *hi_more_info(gchar *entry);

static ModuleEntry entries[] = {
    {N_("Processor"), "processor.png", callback_processors, scan_processors, MODULE_FLAG_NONE},
    {N_("Memory"), "memory.png", callback_memory, scan_memory, MODULE_FLAG_NONE},
    {N_("PCI Devices"), "devices.png", callback_pci, scan_pci, MODULE_FLAG_NONE},
    {N_("USB Devices"), "usb.png", callback_usb, scan_usb, MODULE_FLAG_NONE},
    {N_("Printers"), "printer.png", callback_printers, scan_printers, MODULE_FLAG_NONE},
................................................................................
    
    return NULL;
}

gchar *get_memory_total(void)
{
    scan_memory(FALSE);
    return moreinfo_lookup ("DEV:Total Memory"); //hi_more_info(N_("Total Memory"));
}

gchar *get_motherboard(void)
{
    char *board_name, *board_vendor;

    scan_dmi(FALSE);
................................................................................
	{"getMotherboard", get_motherboard},
	{NULL}
    };

    return m;
}

gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("DEV", entry);
    
    if (info)
	return g_strdup(info);

    return g_strdup("?");

Changes to modules/devices/spd-decode.c.

38
39
40
41
42
43
44

45
46
47
48
49
50
51
..
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
....
1134
1135
1136
1137
1138
1139
1140























































































































1141
1142
1143
1144
1145
1146
1147
....
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
....
1211
1212
1213
1214
1215
1216
1217


1218
1219
1220
1221
1222
1223
1224
....
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281







1282
1283
1284


1285
1286
1287


1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
    EDO,
    PIPELINED_NIBBLE,
    SDR_SDRAM,
    MULTIPLEXED_ROM,
    DDR_SGRAM,
    DDR_SDRAM,
    DDR2_SDRAM,

} RamType;

char *spd_info = NULL;

static const char *ram_types[] = {
    "Unknown",
    "Direct Rambus",
................................................................................
    "FPM DRAM",
    "EDO",
    "Pipelined Nibble",
    "SDR SDRAM",
    "Multiplexed ROM",
    "DDR SGRAM",
    "DDR SDRAM",
    "DDR2 SDRAM"

};

static const char *vendors1[] = { "AMD", "AMI", "Fairchild", "Fujitsu",
    "GTE", "Harris", "Hitachi", "Inmos",
    "Intel", "I.T.T.", "Intersil",
    "Monolithic Memories",
    "Mostek",
................................................................................
                           "tRAS=%.2f\n",
                           ddr_clock, pc2_speed,
                           bytes[62] >> 4, bytes[62] & 0xf,
                           tcl, trcd, trp, tras);
}

























































































































static void decode_module_manufacturer(unsigned char *bytes,
				       char **manufacturer)
{
    char *out = "Unknown";
    unsigned char first;
    int ai = 0;
    int len = 8;
................................................................................
    }
}

static void decode_module_part_number(unsigned char *bytes,
				      char *part_number)
{
    if (part_number) {
	bytes += 8;

	while (*bytes++ && *bytes >= 32 && *bytes < 127) {
	    *part_number++ = *bytes;
	}
	*part_number = '\0';
    }
}
................................................................................
	    return MULTIPLEXED_ROM;
	case 6:
	    return DDR_SGRAM;
	case 7:
	    return DDR_SDRAM;
	case 8:
	    return DDR2_SDRAM;


	}
    }

    return UNKNOWN;
}

static void read_spd(char *spd_path, int offset, size_t size, int use_sysfs, unsigned char *bytes_out)
................................................................................
    
    for (dimm = dimm_list; dimm; dimm = dimm->next, count++) {
        gchar *spd_path = (gchar *)dimm->data;
        gchar *manufacturer;
        gchar *detailed_info;
        gchar *moreinfo_key;
        gchar part_number[32];
        unsigned char bytes[64];
        int module_size;
        RamType ram_type;
        
        shell_status_pulse();
        
        read_spd(spd_path, 0, 64, use_sysfs, bytes);
        ram_type = decode_ram_type(bytes);

        switch (ram_type) {
        case DDR2_SDRAM:
            detailed_info = decode_ddr2_sdram(bytes, &module_size);







            break;
        case DDR_SDRAM:
            detailed_info = decode_ddr_sdram(bytes, &module_size);


            break;
        case SDR_SDRAM:
            detailed_info = decode_sdr_sdram(bytes, &module_size);


            break;
        default:
            DEBUG("Unsupported EEPROM type: %s\n", ram_types[ram_type]);
            continue;
        }
        
        read_spd(spd_path, 64, 64, use_sysfs, bytes);
        decode_module_manufacturer(bytes, &manufacturer);
        decode_module_part_number(bytes, part_number);
        
        gchar *key = g_strdup_printf("MEM%d", count);
        moreinfo_add_with_prefix("DEV", key, g_strdup(detailed_info));
        g_free(key);
        g_string_append_printf(output,
                               "$MEM%d$%d=%s|%d MB|%s\n",
                               count, count,







>







 







|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>
>







 







|





|




|
>
>
>
>
>
>
>



>
>



>
>






|
<
<







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
....
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
....
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
....
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
....
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428


1429
1430
1431
1432
1433
1434
1435
    EDO,
    PIPELINED_NIBBLE,
    SDR_SDRAM,
    MULTIPLEXED_ROM,
    DDR_SGRAM,
    DDR_SDRAM,
    DDR2_SDRAM,
    DDR3_SDRAM
} RamType;

char *spd_info = NULL;

static const char *ram_types[] = {
    "Unknown",
    "Direct Rambus",
................................................................................
    "FPM DRAM",
    "EDO",
    "Pipelined Nibble",
    "SDR SDRAM",
    "Multiplexed ROM",
    "DDR SGRAM",
    "DDR SDRAM",
    "DDR2 SDRAM",
    "DDR3 SDRAM"
};

static const char *vendors1[] = { "AMD", "AMI", "Fairchild", "Fujitsu",
    "GTE", "Harris", "Hitachi", "Inmos",
    "Intel", "I.T.T.", "Intersil",
    "Monolithic Memories",
    "Mostek",
................................................................................
                           "tRAS=%.2f\n",
                           ddr_clock, pc2_speed,
                           bytes[62] >> 4, bytes[62] & 0xf,
                           tcl, trcd, trp, tras);
}



static void decode_ddr3_module_speed(unsigned char *bytes,
				     float *ddr_clock, int *pc3_speed)
{
    float ctime;
    float ddrclk;
    int tbits, pcclk;
	float mtb=0.125;

    if (bytes[10]==1 && bytes[11]==8) mtb=0.125;
    if (bytes[10]==1 && bytes[11]==15) mtb=0.125;
    ctime = mtb * bytes[12];

    ddrclk = 2 * (1000 / ctime);

	tbits=64;
	switch (bytes[8]) {
		case 1: tbits=16;
		case 4: tbits=32;
		case 3: case 0xb: tbits=64;
	}

    pcclk = ddrclk * tbits / 8;
    pcclk -= pcclk % 100;

    if (ddr_clock) {
	*ddr_clock = (int) ddrclk;
    }
    if (pc3_speed) {
	*pc3_speed = pcclk;
    }
}

static void decode_ddr3_module_size(unsigned char *bytes, int *size)
{
    *size = 512 << bytes[4];
}

static void decode_ddr3_module_timings(unsigned char *bytes, float *trcd,
				       float *trp, float *tras, float *tcl)
{
    float ctime;
    float highest_cas = 0;
    int i;
	float mtb=0.125;

    if (bytes[10]==1 && bytes[11]==8) mtb=0.125;
    if (bytes[10]==1 && bytes[11]==15) mtb=0.125;
    ctime = mtb * bytes[12];

	switch (bytes[14]) {
		case 6: highest_cas = 5;
		case 4: highest_cas = 6;
		case 0xc: highest_cas = 7;
		case 0x1e: highest_cas = 8;
	}
    if (trcd) {
	*trcd = bytes[18] * mtb;
    }

    if (trp) {
	*trp = bytes[20] * mtb;
    }

    if (tras) {
	*tras = (bytes[22]+bytes[21] & 0xf)*mtb;
    }

    if (tcl) {
	*tcl = highest_cas;
    }
}


static gchar *decode_ddr3_sdram(unsigned char *bytes, int *size)
{
    float ddr_clock;
    float trcd, trp, tras, tcl;
    int pc3_speed;

    decode_ddr3_module_speed(bytes, &ddr_clock, &pc3_speed);
    decode_ddr3_module_size(bytes, size);
    decode_ddr3_module_timings(bytes, &trcd, &trp, &tras, &tcl);
    
    return g_strdup_printf("[Module Information]\n"
                           "Module type=DDR3 %.2f MHz (PC3-%d)\n"
                           "SPD revision=%d.%d\n"
                           "[Timings]\n"
                           "tCL=%.2f\n"
                           "tRCD=%.3fns\n"
                           "tRP=%.3fns\n"
                           "tRAS=%.3fns\n",
                           ddr_clock, pc3_speed,
                           bytes[1] >> 4, bytes[1] & 0xf,
                           tcl, trcd, trp, tras);
}

static void decode_ddr3_part_number(unsigned char *bytes,
				      char *part_number)
{
	int i;
    if (part_number) {
	for (i=128; i<=145; i++)
		*part_number++ = bytes[i];
	*part_number = '\0';		
    }
}

static void decode_ddr3_manufacturer(unsigned char *bytes,
				       char **manufacturer)
{
	char *out="Unknown";

  end:
    if (manufacturer) {
	*manufacturer = out;
    }
}

static void decode_module_manufacturer(unsigned char *bytes,
				       char **manufacturer)
{
    char *out = "Unknown";
    unsigned char first;
    int ai = 0;
    int len = 8;
................................................................................
    }
}

static void decode_module_part_number(unsigned char *bytes,
				      char *part_number)
{
    if (part_number) {
	bytes += 8+64;

	while (*bytes++ && *bytes >= 32 && *bytes < 127) {
	    *part_number++ = *bytes;
	}
	*part_number = '\0';
    }
}
................................................................................
	    return MULTIPLEXED_ROM;
	case 6:
	    return DDR_SGRAM;
	case 7:
	    return DDR_SDRAM;
	case 8:
	    return DDR2_SDRAM;
	case 11:
		return DDR3_SDRAM;
	}
    }

    return UNKNOWN;
}

static void read_spd(char *spd_path, int offset, size_t size, int use_sysfs, unsigned char *bytes_out)
................................................................................
    
    for (dimm = dimm_list; dimm; dimm = dimm->next, count++) {
        gchar *spd_path = (gchar *)dimm->data;
        gchar *manufacturer;
        gchar *detailed_info;
        gchar *moreinfo_key;
        gchar part_number[32];
        unsigned char bytes[256];
        int module_size;
        RamType ram_type;
        
        shell_status_pulse();
        
        read_spd(spd_path, 0, 256, use_sysfs, bytes);
        ram_type = decode_ram_type(bytes);

        switch (ram_type) {
        case DDR2_SDRAM:
			detailed_info = decode_ddr2_sdram(bytes, &module_size);
			decode_module_part_number(bytes, part_number);
			decode_module_manufacturer(bytes+64, &manufacturer);
			break;
        case DDR3_SDRAM:
            detailed_info = decode_ddr3_sdram(bytes, &module_size);
			decode_ddr3_part_number(bytes, part_number);    
			decode_ddr3_manufacturer(bytes, &manufacturer);
            break;
        case DDR_SDRAM:
            detailed_info = decode_ddr_sdram(bytes, &module_size);
			decode_module_part_number(bytes, part_number);
			decode_module_manufacturer(bytes+64, &manufacturer);
            break;
        case SDR_SDRAM:
            detailed_info = decode_sdr_sdram(bytes, &module_size);
			decode_module_part_number(bytes, part_number);
			decode_module_manufacturer(bytes+64, &manufacturer);    
            break;
        default:
            DEBUG("Unsupported EEPROM type: %s\n", ram_types[ram_type]);
            continue;
        }
        
        


        
        gchar *key = g_strdup_printf("MEM%d", count);
        moreinfo_add_with_prefix("DEV", key, g_strdup(detailed_info));
        g_free(key);
        g_string_append_printf(output,
                               "$MEM%d$%d=%s|%d MB|%s\n",
                               count, count,

Changes to modules/devices/usb.c.

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
    }

    fclose(dev);

    return n > 0;
}

void __scan_usb_lsusb_add_device(char *buffer, 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 (position = ftell(lsusb); fgets(buffer, 512, 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);
................................................................................
       moreinfo_del_with_prefix("DEV:USB");
	g_free(usb_list);
    }
    usb_list = g_strdup("[USB Devices]\n");

    while (fgets(buffer, sizeof(buffer), temp_lsusb)) {
        if (g_str_has_prefix(buffer, "Bus ")) {
           __scan_usb_lsusb_add_device(buffer, temp_lsusb, ++usb_device_number);
        }
    }
    
    fclose(temp_lsusb);
    
    return usb_device_number > 0;
}







|










|







 







|







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
    }

    fclose(dev);

    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);
................................................................................
       moreinfo_del_with_prefix("DEV:USB");
	g_free(usb_list);
    }
    usb_list = g_strdup("[USB Devices]\n");

    while (fgets(buffer, sizeof(buffer), temp_lsusb)) {
        if (g_str_has_prefix(buffer, "Bus ")) {
           __scan_usb_lsusb_add_device(buffer, sizeof(buffer), temp_lsusb, ++usb_device_number);
        }
    }
    
    fclose(temp_lsusb);
    
    return usb_device_number > 0;
}

Changes to modules/network.c.

375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
{
    return g_strdup_printf("%s\n"
                           "[$ShellParam$]\n"
                           "ReloadInterval=3000\n",
                            __statistics);
}

static gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("NET", entry);

    if (info)
	return g_strdup(info);

    return g_strdup_printf("[%s]", entry);







|







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
{
    return g_strdup_printf("%s\n"
                           "[$ShellParam$]\n"
                           "ReloadInterval=3000\n",
                            __statistics);
}

gchar *hi_more_info(gchar * entry)
{
    gchar *info = moreinfo_lookup_with_prefix("NET", entry);

    if (info)
	return g_strdup(info);

    return g_strdup_printf("[%s]", entry);