diff options
| author | Agney Lopes Roth Ferraz <agney@debian.org> | 2007-04-09 11:45:31 -0300 | 
|---|---|---|
| committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 | 
| commit | adb3993ba087ede46f62d5f018e17b07e99b5260 (patch) | |
| tree | 67b4fa7e224f09d21eb76060422ca23e50e6dfe0 /arch/linux/common/.svn/text-base/usb.h.svn-base | |
| parent | b3e31ae3787c8806f48c85a52bba9aa3554e2c07 (diff) | |
| parent | 11b8179a57e675c6672cbe649c655230ae3e9744 (diff) | |
Import Debian changes 0.4.2.1-1
hardinfo (0.4.2.1-1) unstable; urgency=low
  * New upstream release.
  * Fixed segfault on device entry (Closes: #387955)
Diffstat (limited to 'arch/linux/common/.svn/text-base/usb.h.svn-base')
| -rw-r--r-- | arch/linux/common/.svn/text-base/usb.h.svn-base | 132 | 
1 files changed, 0 insertions, 132 deletions
| diff --git a/arch/linux/common/.svn/text-base/usb.h.svn-base b/arch/linux/common/.svn/text-base/usb.h.svn-base deleted file mode 100644 index a52be2cb..00000000 --- a/arch/linux/common/.svn/text-base/usb.h.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -/* - *    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 - */ - -static gboolean -remove_usb_devices(gpointer key, gpointer value, gpointer data) -{ -    if (!strncmp((gchar *) key, "USB", 3)) { -	GtkTreeIter *iter = (GtkTreeIter *) data; - -	g_free((gchar *) value); -	g_free(iter); - -	return TRUE; -    } -    return FALSE; -} - -static gchar *usb_list = NULL; -void -scan_usb(void) -{ -    FILE *dev; -    gchar buffer[128]; -    gchar *tmp, *manuf = NULL, *product = NULL, *mxpwr; -    gint bus, level, port, classid, trash; -    gint vendor, prodid; -    gfloat ver, rev, speed; -    int n = 0; - -    dev = fopen("/proc/bus/usb/devices", "r"); -    if (!dev) -	return; - -    if (usb_list) { -	g_hash_table_foreach_remove(devices, remove_usb_devices, NULL); -	g_free(usb_list); -    } -    usb_list = g_strdup(""); - -    while (fgets(buffer, 128, dev)) { -	tmp = buffer; - -	switch (*tmp) { -	case 'T': -	    sscanf(tmp, -		   "T:  Bus=%d Lev=%d Prnt=%d Port=%d Cnt=%d Dev#=%d Spd=%f", -		   &bus, &level, &trash, &port, &trash, &trash, &speed); -	    break; -	case 'D': -	    sscanf(tmp, "D:  Ver=%f Cls=%x", &ver, &classid); -	    break; -	case 'P': -	    sscanf(tmp, "P:  Vendor=%x ProdID=%x Rev=%f", -		   &vendor, &prodid, &rev); -	    break; -	case 'S': -	    if (strstr(tmp, "Manufacturer=")) { -		manuf = g_strdup(strchr(tmp, '=') + 1); -		remove_linefeed(manuf); -	    } else if (strstr(tmp, "Product=")) { -		product = g_strdup(strchr(tmp, '=') + 1); -		remove_linefeed(product); -	    } -	    break; -	case 'C': -	    mxpwr = strstr(buffer, "MxPwr=") + 6; - -	    tmp = g_strdup_printf("USB%d", ++n); -	     -	    if (*product == '\0') { -	        g_free(product); -	        if (classid == 9) { -                    product = g_strdup_printf("USB %.2f Hub", ver); -                } else { -  	            product = g_strdup_printf("Unknown USB %.2f Device (class %d)", -                                              ver, classid); -                } -	    } -	     - -	    if (classid == 9) {	/* hub */ -    	        usb_list = g_strdup_printf("%s[%s#%d]\n", -		      		           usb_list, product, n); -            } else { /* everything else */ -    	        usb_list = g_strdup_printf("%s$%s$%s=\n", -		      		           usb_list, tmp, product); - -                gchar *strhash = g_strdup_printf("[Device Information]\n" -                                                 "Product=%s\n" -                                                 "Manufacturer=%s\n" -                                                 "[Port #%d]\n" -                                                 "Speed=%.2fMbit/s\n" -                                                 "Max Current=%s\n" -                                                 "[Misc]\n" -                                                 "USB Version=%.2f\n" -                                                 "Revision=%.2f\n" -                                                 "Class=0x%x\n" -                                                 "Vendor=0x%x\n" -                                                 "Product ID=0x%x\n" -                                                 "Bus=%d\n" "Level=%d\n", -                                                 product, manuf, -                                                 port, speed, mxpwr, -                                                 ver, rev, classid, -                                                 vendor, prodid, bus, level); - -                g_hash_table_insert(devices, tmp, strhash); -            } - -	    g_free(manuf); -	    g_free(product); -	    manuf = g_strdup(""); -	    product = g_strdup(""); -	} -    } - -    fclose(dev); -} | 
