diff options
| author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-06-21 00:45:20 +0000 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-06-21 00:45:20 +0000 | 
| commit | 179894d3dc9511c2a6d9d74e0af812e5378b3a42 (patch) | |
| tree | a494717a1602388b3af6f80c1ed2e1959328eeb7 /hardinfo2 | |
| parent | 9f4da1891acbb7ae581285a9cd55171b10459de1 (diff) | |
Show vendor full name and URL in USB, storage and PCI device info
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/Makefile.in | 3 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/pci.h | 11 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/storage.h | 11 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/usb.h | 7 | ||||
| -rw-r--r-- | hardinfo2/devices.c | 2 | ||||
| -rw-r--r-- | hardinfo2/vendor.c | 83 | ||||
| -rw-r--r-- | hardinfo2/vendor.h | 33 | 
7 files changed, 148 insertions, 2 deletions
| diff --git a/hardinfo2/Makefile.in b/hardinfo2/Makefile.in index 032b2629..51b35714 100644 --- a/hardinfo2/Makefile.in +++ b/hardinfo2/Makefile.in @@ -6,7 +6,8 @@ CFLAGS = -fPIC -pipe -Wall -g $(GTK_CFLAGS) $(GLADE_CFLAGS) -I.  # ----------------------------------------------------------------------------  OBJECTS = hardinfo.o shell.o util.o iconcache.o loadgraph.o sha1.o md5.o \ -		menu.o stock.o callbacks.o expr.o report.o blowfish.o binreloc.o +		menu.o stock.o callbacks.o expr.o report.o blowfish.o binreloc.o \ +		vendor.o  MODULES = computer.so devices.so benchmark.so   all:	$(OBJECTS) $(MODULES) diff --git a/hardinfo2/arch/linux/common/pci.h b/hardinfo2/arch/linux/common/pci.h index f8c9d319..e7c940bb 100644 --- a/hardinfo2/arch/linux/common/pci.h +++ b/hardinfo2/arch/linux/common/pci.h @@ -171,6 +171,17 @@ scan_pci(void)  					"Bus, device, function=%d, %d, %d\n",  					name, category, domain, bus,  					device, function); +             +            const gchar *url = vendor_get_url(name); +            if (url) { +                strdevice = g_strdup_printf("%s" +                                            "Vendor=%s (%s)\n", +                                            strdevice, +                                            vendor_get_name(name), +                                            url); +            } +             +              	    pci_list = g_strdup_printf("%s$PCI%d$%s=%s\n", pci_list, n, category,  				name); diff --git a/hardinfo2/arch/linux/common/storage.h b/hardinfo2/arch/linux/common/storage.h index 4fb682a9..7321f70e 100644 --- a/hardinfo2/arch/linux/common/storage.h +++ b/hardinfo2/arch/linux/common/storage.h @@ -120,6 +120,7 @@ scan_scsi(void)  	    gchar *strhash = g_strdup_printf("[Device Information]\n"  					     "Model=%s\n" +					     "Vendor=%s (%s)\n"  					     "Type=%s\n"  					     "Revision=%s\n"  					     "[SCSI Controller]\n" @@ -127,6 +128,8 @@ scan_scsi(void)  					     "Channel=%d\n"  					     "ID=%d\n" "LUN=%d\n",  					     model, +					     vendor_get_name(model), +					     vendor_get_url(model),  					     type,  					     revision,  					     scsi_controller, @@ -242,9 +245,15 @@ scan_ide(void)  	    gchar *strhash = g_strdup_printf("[Device Information]\n"  					     "Model=%s\n" +					     "Vendor=%s (%s)\n"  					     "Device Name=hd%c\n"  					     "Media=%s\n" "Cache=%dkb\n", -					     model, iface, media, cache); +					     model, +					     vendor_get_name(model), +					     vendor_get_url(model), +					     iface, +					     media, +					     cache);  	    if (pgeometry && lgeometry)  		strhash = g_strdup_printf("%s[Geometry]\n"  					  "Physical=%s\n" diff --git a/hardinfo2/arch/linux/common/usb.h b/hardinfo2/arch/linux/common/usb.h index a52be2cb..4fd6ee21 100644 --- a/hardinfo2/arch/linux/common/usb.h +++ b/hardinfo2/arch/linux/common/usb.h @@ -100,6 +100,13 @@ scan_usb(void)      	        usb_list = g_strdup_printf("%s$%s$%s=\n",  		      		           usb_list, tmp, product); +                const gchar *url = vendor_get_url(manuf); +                if (url) { +                    gchar *tmp = g_strdup_printf("%s (%s)", manuf, url); +                    g_free(manuf); +                    manuf = tmp; +                } +                  gchar *strhash = g_strdup_printf("[Device Information]\n"                                                   "Product=%s\n"                                                   "Manufacturer=%s\n" diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c index 07946755..1180a092 100644 --- a/hardinfo2/devices.c +++ b/hardinfo2/devices.c @@ -58,6 +58,8 @@ static gchar *storage_list = "";      continue;                        \    } +#include <vendor.h> +  #include <arch/this/pci.h>  #include <arch/this/modules.h>  #include <arch/common/printers.h> diff --git a/hardinfo2/vendor.c b/hardinfo2/vendor.c new file mode 100644 index 00000000..e6ceff79 --- /dev/null +++ b/hardinfo2/vendor.c @@ -0,0 +1,83 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    List of vendors based on GtkSysInfo (c) Pissens Sebastien. + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +#include <string.h> +#include <gtk/gtk.h> +#include "vendor.h" + +/* + * List of vendors based on GtkSysInfo1.9beta1 list by Pissens Sebastien, also + * licensed under the GNU GPL version 2. + */ + +static const Vendor vendors[] = { +    { "ATI",			"ATI",			"www.ati.com" }, +    { "nVidia",			"NVIDIA",		"www.nvidia.com" }, +    { "3Com",			"3Com",			"www.3com.com" }, +    { "Intel"	,		"INTEL",		"www.intel.com" }, +    { "Cirrus Logic",		"Cirrus Logic",		"www.cirrus.com" }, +    { "VIA Technologies",	"VIA Technologies",	"www.via.com.tw" }, +    { "hp",			"Hewlett-Packard",	"www.hp.com" }, +    { "NEC Corporation",	"NEC Coporation",	"www.nec.com" }, +    { "MAXTOR",			"MAXTOR",		"www.maxtor.com" }, +    { "SAMSUNG",		"SANSUNG",		"www.samsung.com" }, +    { "PIONEER",		"PIONEER",		"www.pioneer-eur.com" }, +    { "PLEXTOR",		"PLEXTOR",		"www.plextor.be" }, +    { "Realtek Semiconductor",	"Realtek",		"www.realtek.com.tw" }, +    { "TOSHIBA",		"TOSHIBA",		"www.toshiba.com" }, +    { "LITE-ON",		"LITE-ON",		"www.liteonit.com" }, +    { "WDC",			"Western Digital",	"www.wdc.com" }, +    { "HL-DT-ST",		"LG",			"www.lge.com" }, +    { "ST",			"SEAGATE",		"www.seagate.com" }, +    { "Lexmark",		"Lexmark",		"www.lexmark.com" }, +    { "_NEC",			"NEC Corporation",	"www.nec.com" }, +    { "Creative Labs",		"Creative Labs",	"www.creative.com" }, +    { "Brooktree",		"Conexant",		"www.brooktree.com" }, +    { "Atheros",		"Atheros Communications","www.atheros.com" }, +    { "MATSHITA",		"Panasonic",		"www.panasonic.com" }, +    { "Silicon Image",		"Silicon Image, Inc.",	"www.siliconimage.com" },  +    { "KYE",			"KYE Systems Corp.",	"www.genius-kye.com" }, +    { NULL,			NULL,			NULL }, +}; + +const gchar *vendor_get_name(const gchar *id) +{ +  int i; +   +  for (i = 0; vendors[i].id; i++) { +    if (strstr(id, vendors[i].id)) +      return vendors[i].name; +  } +   +  return id; +} + +const gchar *vendor_get_url(const gchar *id) +{ +  int i; +   +  for (i = 0; vendors[i].id; i++) { +    if (strstr(id, vendors[i].id)) +      return vendors[i].url; +  } +   +  return NULL; +} + diff --git a/hardinfo2/vendor.h b/hardinfo2/vendor.h new file mode 100644 index 00000000..7c6d8efd --- /dev/null +++ b/hardinfo2/vendor.h @@ -0,0 +1,33 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +#ifndef __VENDOR_H__ +#define __VENDOR_H__ + +typedef struct _Vendor	Vendor; +struct _Vendor { +  char *id; +  char *name; +  char *url; +}; + +const gchar *vendor_get_name(const gchar *id); +const gchar *vendor_get_url(const gchar *id); + + +#endif	/* __VENDOR_H__ */ | 
