On Mon, 11 Jun 2007, Dave Mielke wrote:

> I'm the maintainer of BRLTTY [http://mielke.cc/brltty/]. Users of a certain
> model of braille display in conjunction with the 2.6.21 Debian kernel are
> reporting that stopping and restarting brltty causes the device to be reset in
> a way which makes it unusable until the next boot.

Do you really need a reboot, or is it enough to unplug and then replug 
the device?

>  Rebuilding the kernel
> without CONFIG_USB_SUSPEND=y causes this problem to go away.
> 
> Brltty uses usbfs to control the device. Would someone please give me an
> explanation regarding which extra operations are being performed at a low 
> level
> when the device is closed and opened, and what, if any, extra usbfs operations
> we should perhaps be doing to try to restore normal device operation. Thanks.

It sounds like the device is being suspended, as you surmised.  And
apparently it doesn't function properly after being resumed, which
means it isn't fully USB-compliant.

There are a few ways around the problem.  You can prevent the device 
from being autosuspended by doing:

        echo 0 >/sys/bus/usb/devices/.../power/autosuspend

(fill in the device ID).  However this would have to be done very 
quickly following device detection to prevent an initial autosuspend.  
(Note that in 2.6.22 the value to write changes from 0 to -1.)

You can add a blacklist entry for this device in 
drivers/usb/core/quirks.c.  That will be a more reliable way to prevent 
autosuspend.

But it won't prevent all suspends; if somebody puts their system to
sleep using suspend-to-RAM then the braille display device will get
suspended along with everything else.  Even if CONFIG_USB_SUSPEND isn't
turned on.  That's true as well for systems preceding 2.6.21.

So the best approach might be for brltty to reset the device using a
USBDEVFS_RESET ioctl (or the libusb equivalent, usb_reset) when the
device file is first opened.  Or maybe to do this if the device fails
to respond to some standard request when it is first opened.

Starting with the 2.6.23 kernel, it will possible to add a quirks.c 
blacklist entry telling the kernel to reset the device automatically 
whenever it gets resumed.  But if you modify the program then this 
won't be necessary.  It's up to you whether or not the entry should be 
added.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to