On Thu, Mar 30, 2000, Matthew Dharm <[EMAIL PROTECTED]> wrote:
> How do I do, from kernel space, a port reset on a device? Apparently
> there are some devices (ie a CD-ROM which is reading from a dirty disk)
> which will get into a jammed state and require a port reset to un-jam it.
>
> At least, according to the spec, a port reset is the "more drastic action"
> that I should try next.
>
> So, how do I do this?
Nonexistant right now. The code to do it would look something like this:
int usb_reset_device(struct usb_device *dev)
{
struct usb_device *parent = dev->parent;
int i;
for (i = 0; i < parent->maxchild; i++) {
if (parent->children[i] == dev)
usb_set_port_feature(parent, i,
USB_PORT_FEAT_RESET);
}
return 0;
}
I haven't tested the code (not even tried compiling it), but I think it
should work. I know the above code won't work on a root hub (it'll
oops).
The device should disconnect and then reconnect. This will cause it to
go through the normal connect and disconnect code paths. This means that
dev, after calling the function is invalid.
usb_set_port_feature is part of hub.c (declared static) so you may want
to throw the function in hub.c and export the symbol from there.
JE
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]