Subject: Re: usb panic
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: current-users
Date: 01/23/2007 12:23:51
This is a multipart MIME message.

--==_Exmh_6309851542140
Content-Type: text/plain; charset=us-ascii


smb@cs.columbia.edu said:
> uvisor0 at uhub1 port 2uhci1: device addr 2 (config 1): can't set self
> powered  onfiguration 

Hmm - this is related to a change I made last week.
It seems that this change triggers an error handling
bug in the uvisor device driver.

My change makes that a status bit of the device is checked
which tells whether the device is self powered or needs to
get by with the power delivered by the USB. If the device
driver tries to set a device configuration which needs
external power but the status bit tells there is none that
message is printed and an error returned.
The uvisor driver doesn't deal with errors during attach
correctly: sc_udev is used in detach, whether initialized
or not. Tha appended patch should avoid the panic.

Now we need to get the thing configured... I don't have
a device myself which can work with and without external
power (except a hub, but hubs are different). So it would be
nice if you could do some checks:
If you connect external power to the Palmpilot, does it work
as before?
Can you build sysutils/usbutil from pkgsrc and dump the
USB descriptors by
usbctl -f /dev/usb1 -a 2
(assuming the device is on usb1 and its address is 2).

thanks & best regards
Matthias


--==_Exmh_6309851542140
Content-Type: text/plain ; name="uvis.txt"; charset=us-ascii
Content-Description: uvis.txt
Content-Disposition: attachment; filename="uvis.txt"

--- uvisor.c.~1.33.~	Mon Nov 20 19:33:33 2006
+++ uvisor.c	Tue Jan 23 11:30:29 2007
@@ -411,8 +411,9 @@ uvisor_detach(device_ptr_t self, int fla
 		}
 	}
 
-	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
-			   USBDEV(sc->sc_dev));
+	if (sc->sc_udev)
+		usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
+				   USBDEV(sc->sc_dev));
 
 
 	return (rv);

--==_Exmh_6309851542140--