svn commit: r187164 - head/sys/dev/usb2/core

Andrew Thompson thompsa at FreeBSD.org
Tue Jan 13 11:01:37 PST 2009


Author: thompsa
Date: Tue Jan 13 19:01:35 2009
New Revision: 187164
URL: http://svn.freebsd.org/changeset/base/187164

Log:
  MFp4: //depot/projects/usb at 155750
  
  	Patch to resolve problems with power mode off.
  	Reported by Alexander Best.
  
  Submitted by: Hans Petter Selasky

Modified:
  head/sys/dev/usb2/core/usb2_generic.c
  head/sys/dev/usb2/core/usb2_hub.c

Modified: head/sys/dev/usb2/core/usb2_generic.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_generic.c	Tue Jan 13 19:01:25 2009	(r187163)
+++ head/sys/dev/usb2/core/usb2_generic.c	Tue Jan 13 19:01:35 2009	(r187164)
@@ -1699,11 +1699,12 @@ ugen_set_power_mode(struct usb2_fifo *f,
 	}
 	switch (mode) {
 	case USB_POWER_MODE_OFF:
-		/* clear suspend */
-		err = usb2_req_clear_port_feature(udev->parent_hub,
-		    NULL, udev->port_no, UHF_PORT_SUSPEND);
-		if (err)
-			break;
+		/* get the device unconfigured */
+		err = ugen_set_config(f, USB_UNCONFIG_INDEX);
+		if (err) {
+			DPRINTFN(0, "Could not unconfigure "
+			    "device (ignored)\n");
+		}
 
 		/* clear port enable */
 		err = usb2_req_clear_port_feature(udev->parent_hub,

Modified: head/sys/dev/usb2/core/usb2_hub.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_hub.c	Tue Jan 13 19:01:25 2009	(r187163)
+++ head/sys/dev/usb2/core/usb2_hub.c	Tue Jan 13 19:01:35 2009	(r187164)
@@ -1823,7 +1823,8 @@ void
 usb2_set_power_mode(struct usb2_device *udev, uint8_t power_mode)
 {
 	/* filter input argument */
-	if (power_mode != USB_POWER_MODE_ON) {
+	if ((power_mode != USB_POWER_MODE_ON) &&
+	    (power_mode != USB_POWER_MODE_OFF)) {
 		power_mode = USB_POWER_MODE_SAVE;
 	}
 	udev->power_mode = power_mode;	/* update copy of power mode */


More information about the svn-src-head mailing list