PERFORCE change 130284 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Dec 5 11:10:44 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=130284

Change 130284 by hselasky at hselasky_laptop001 on 2007/12/05 19:10:08

	
	Workaround for buggy USB devices that have no strings.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#66 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#66 (text+ko) ====

@@ -1471,9 +1471,29 @@
 		udev->no_strings = 1;
 	}
 #endif
+
+	/*
+	 * Workaround for buggy USB devices.
+	 *
+	 * It appears that some string-less USB chips will crash and
+	 * disappear if any attempts are made to read any string
+	 * descriptors.
+	 *
+	 * Try to detect such chips by checking the strings in the USB
+	 * device descriptor. If no strings are present there we
+	 * simply disable all USB strings.
+	 */
+
+	if (udev->ddesc.iManufacturer ||
+	    udev->ddesc.iProduct ||
+	    udev->ddesc.iSerialNumber) {
 	/* setup language ID */
 	err = usbreq_get_string_desc(udev, &usb_global_lock, buf, 4,
 	    0, USB_LANGUAGE_TABLE);
+	} else {
+	  err = USBD_INVAL;
+	}
+
 	if (err || (buf[0] < 4)) {
 		udev->no_strings = 1;
 	} else {


More information about the p4-projects mailing list