diff options
| author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-02-21 23:46:18 -0300 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-02-21 23:46:18 -0300 | 
| commit | 22fe41b021367d807607738b3eee785d3ba78608 (patch) | |
| tree | f13ee2bd56939285a9014332adc3c0b806bbf331 | |
| parent | 14acc526ad11fdd2d7192a4028828e178d563225 (diff) | |
Fix SCSI information (when devices does not report their revision versions)
| -rw-r--r-- | hardinfo2/arch/linux/common/storage.h | 31 | 
1 files changed, 8 insertions, 23 deletions
| diff --git a/hardinfo2/arch/linux/common/storage.h b/hardinfo2/arch/linux/common/storage.h index 981de986..5208f028 100644 --- a/hardinfo2/arch/linux/common/storage.h +++ b/hardinfo2/arch/linux/common/storage.h @@ -56,28 +56,13 @@ __scan_scsi_devices(void)  	    n++;  	} else if (!strncmp(buf, "Vendor: ", 8)) { -	    char *p; -	    char *rev = strstr(buf, "Rev: "); - -	    model = strstr(buf, "Model: "); - -	    if (model == NULL) { -		model = buf + strlen(buf); -	    } -	    p = model; -	    while (*(--p) == ' '); -	    *(++p) = 0; -	    vendor = g_strdup(buf + 8); - -	    if (rev != NULL) { -		revision = g_strdup(rev + 5); -	    } else { -		rev = model + strlen(model); -	    } -	    p = rev; -	    while (*(--p) == ' '); -	    *(++p) = 0; -	    model = g_strdup_printf("%s %s", vendor, model + 7); +	    buf[17] = '\0'; +	    buf[41] = '\0'; +	    buf[53] = '\0'; +	     +	    vendor   = g_strdup(g_strstrip(buf + 8)); +	    model    = g_strdup_printf("%s %s", vendor, g_strstrip(buf + 24)); +	    revision = g_strdup(g_strstrip(buf + 46));  	} else if (!strncmp(buf, "Type:   ", 8)) {  	    char *p;  	    gchar *type = NULL, *icon = NULL; @@ -124,7 +109,7 @@ __scan_scsi_devices(void)  	    storage_icons = h_strdup_cprintf("Icon$%s$%s=%s.png\n", storage_icons, devid, model, icon);  	    gchar *strhash = g_strdup_printf("[Device Information]\n" -					     "Model=%s\n",model); +					     "Model=%s\n", model);  	    const gchar *url = vendor_get_url(model);  	    if (url) { | 
