qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Large USB-Patch Documentation and todays CVS patch


From: Lonnie Mendez
Subject: Re: [Qemu-devel] Large USB-Patch Documentation and todays CVS patch
Date: Thu, 27 Apr 2006 08:29:51 -0500
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Johannes Schindelin wrote:

Also, you rename some things when it has no apparent use to rename them,
such as usb_device_add, or product_name.
Sorry but on that point you say things which are in no case provable by
any study.

Also kindly look into line 1417 and 1419 of your patch. You will find the
renaming o f product_name to prod_name.

  That was my doing.

manufacturer_name
product_name

   I have a habit of making related variables short and uniform in length.
--- qemu/usb-linux.c    2006-04-27 08:18:38.000000000 -0500
+++ qemu/usb-linux.c    2006-04-27 08:26:04.000000000 -0500
@@ -44,9 +44,9 @@
 
 typedef int USBScanFunc(void *opaque, int bus_num, int addr,
                         int vendor_id, int product_id, 
-                        const char *spec_version,
-                        const char *manf_string,
-                        const char *prod_string);
+                        const char *specification_version,
+                        const char *manufacturer_string,
+                        const char *product_string);
 static int usb_host_find_device(int *pbus_num, int *paddr, 
                                 const char *devname);
 int usb_host_handle_close(USBDevice *opaque);
@@ -282,9 +282,9 @@
     char buf[1024];
     int bus_num, addr, device_count, product_id, vendor_id;
     int ret;
-    char manf_name[512];
-    char prod_name[512];
-    char spec_version[6];
+    char manufacturer_name[512];
+    char product_name[512];
+    char specification_version[6];
     
     f = fopen(USBDEVFS_PATH "/devices", "r");
     if (!f) {
@@ -303,7 +303,7 @@
             if (device_count && (vendor_id || product_id)) {
                 /* New device.  Add the previously discovered device.  */
                 ret = func(opaque, bus_num, addr, vendor_id, product_id,
-                           spec_version, manf_name, prod_name);
+                           specification_version, manufacturer_name, 
product_name);
                 if (ret)
                     goto the_end;
             }
@@ -313,9 +313,9 @@
             if (get_tag_value(buf, sizeof(buf), line, "Dev#=", " ") < 0)
                 goto fail;
             addr = atoi(buf);
-            strcpy(spec_version, "01.10");
-            strcpy(manf_name, "unknown");
-            strcpy(prod_name, "unknown");
+            strcpy(specification_version, "01.10");
+            strcpy(manufacturer_name, "unknown");
+            strcpy(product_name, "unknown");
             device_count++;
             product_id = 0;
             vendor_id = 0;
@@ -323,7 +323,7 @@
             if (get_tag_value(&buf[1], sizeof(buf) - 1, line, "Ver=", " ") < 0)
                 goto fail;
             buf[0] = '0';
-            pstrcpy(spec_version, sizeof(spec_version), buf);
+            pstrcpy(specification_version, sizeof(specification_version), buf);
         } else if (line[0] == 'P' && line[1] == ':') {
             if (get_tag_value(buf, sizeof(buf), line, "Vendor=", " ") < 0)
                 goto fail;
@@ -336,18 +336,18 @@
                 if (get_tag_value(buf, sizeof(buf), line, "Product=", "") < 0) 
{
                     goto fail;
                 } else {
-                    pstrcpy(prod_name, sizeof(prod_name), buf);
+                    pstrcpy(product_name, sizeof(product_name), buf);
                 }
             } else {
-                pstrcpy(manf_name, sizeof(manf_name), buf);
+                pstrcpy(manufacturer_name, sizeof(manufacturer_name), buf);
             }
         }
     fail: ;
     }
     if (device_count && (vendor_id || product_id)) {
         /* Add the last device.  */
-        ret = func(opaque, bus_num, addr, vendor_id, product_id, spec_version,
-                   manf_name, prod_name);
+        ret = func(opaque, bus_num, addr, vendor_id, product_id,
+                   specification_version, manufacturer_name, product_name);
     }
  the_end:
     fclose(f);
@@ -363,9 +363,9 @@
 
 static int usb_host_find_device_scan(void *opaque, int bus_num, int addr,
                                      int vendor_id, int product_id,
-                                     const char *spec_version,
-                                     const char *manf_string,
-                                     const char *prod_string)
+                                     const char *specification_version,
+                                     const char *manufacturer_string,
+                                     const char *product_string)
 {
     FindDeviceState *s = opaque;
     if (vendor_id == s->vendor_id &&
@@ -408,14 +408,14 @@
 
 static int usb_host_info_device(void *opaque, int bus_num, int addr, 
                                 int vendor_id, int product_id,
-                                const char *spec_ver,
-                                const char *manf_string,
-                                const char *prod_string)
+                                const char *specification_version,
+                                const char *manufacturer_string,
+                                const char *product_string)
 {
     term_printf("  Device host:%03d:%03d, Manufacturer %s, Product %s\n",
-                bus_num, addr, manf_string, prod_string );
+                bus_num, addr, manufacturer_string, product_string );
     term_printf("     VendorID:ProductID %04xx%04x, USB-Standard: %s\n",
-                vendor_id, product_id, spec_ver );
+                vendor_id, product_id, specification_version );
     return 0;
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]