Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Resetting an usb device
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sat Sep 12, 2015 7:08 am    Post subject: Resetting an usb device Reply with quote

I have a machine with an usb dvb-stick permanently attached. After a few days (not very reproducible) this stick fails to work, that is, it produces no output anymore (it still shows up with "lsusb" and reacts to commands, but does not output DV data).

With physical access to the machine, the fix is easy: Pull the stick for a few seconds, put it back, and everything works again.

But what to do without physical access? Rebooting the machine does not help (apparently, this does not cut power of USB devices, or at least not long enough).
Is there perhaps a command I could attempt to send a "reset" to that USB stick? I read that some machines have an /usr/sbin/usbreset binary, but I don't have such a binary, and it is not listed in www.portagefilelist.de either.


Last edited by mv on Tue Sep 22, 2015 6:48 am; edited 2 times in total
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1074
Location: EU or US

PostPosted: Sat Sep 12, 2015 12:13 pm    Post subject: Reply with quote

Maybe this helps.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sat Sep 12, 2015 5:00 pm    Post subject: Reply with quote

Thanks. That's really a lot of hints. I will report back after a while when the problem reoccurs.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sun Sep 20, 2015 11:24 am    Post subject: Reply with quote

The binary obtained from usbreset.c (from the above link) works like a charm. :D
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Tue Sep 22, 2015 6:51 am    Post subject: Reply with quote

Now when it happened again, the usbreset binary did not help. Also the other hints from the above link did not help (after trying the "remove" hint, I had to restart the machine, but it didn't help, either).

However, manually unplugging the device for 1 second was enough... I am beginning to suspect that this cannot be solved by software. :(

(There was an upgrade from hardened-sources-4.1.6 to hardened-sources-4.1.7-r1 meanwhile, but I would be very surprised if this upgrade had just broken the usbreset functionality...)
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 6693
Location: &akkara

PostPosted: Tue Sep 22, 2015 7:59 am    Post subject: Reply with quote

Try unloading its driver module, then reloading it. (Obviously it needs to be compiled as 'module' in the kernel config for this to have any hope of working.) You probably will need to quit whatever application(s) are using it before the kernel will let you unload the module. If that doesn't work, try mixing it in with the reset thing above.

Hmmm... on 2nd thought, if even a reboot didn't do it, it sounds like there's probably a bug in the USB device's firmware.
_________________
Many think that Dilbert is a comic. Unfortunately it is a documentary.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Wed Sep 23, 2015 8:00 am    Post subject: Reply with quote

Akkara wrote:
if even a reboot didn't do it, it sounds like there's probably a bug in the USB device's firmware.

Yes, a reboot doesn't help at all. However, maybe there is still the possibility to send some "reset" signal which might restart that firmware and which is usually not sent on reboot...
The stick had worked for several months without such problems, so I would exclude a firmware problem. It is probably some hardware problem, but it does not put the stick into a completely crashed state: The stick still shows up correctly with e.g. lsusb and can be connected to with tzap - it reports back after a while that it found a signal, but just doesn't output anything (when it is in this "bad" state).
Also the above usbreset program reports that the reset signal was succesfully sent...
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 185
Location: Gliwice

PostPosted: Thu Sep 24, 2015 4:06 am    Post subject: Reply with quote

You can put the reset program in the cron, and reset your USB device when it still works (for example every day at midnight), instead of waiting until it get hardlocked.
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1655
Location: United Kingdom

PostPosted: Fri Sep 25, 2015 2:34 am    Post subject: Reply with quote

I wonder if unbinding the driver from the USB dvb stick then rebinding the driver to the stick would make the stick work again (see Manual driver binding and unbinding)?

For example, when I wanted to unbind the usb_storage kernel module from a USB storage device, I found out which bus ID the USB device was plugged into (1-1.2.2:1.2 in my case) and then used the following command:

Code:
echo -n "1-1.2.2:1.2" > /sys/bus/usb/drivers/usb-storage/unbind

To rebind the driver to the USB device I then used the following command:

Code:
echo -n "1-1.2.2:1.2" > /sys/bus/usb/drivers/usb-storage/bind

In your case the driver will not be usb_storage but the principle would still apply. Worth a shot, anyway, just to see if it has an effect after the stick stops working.
_________________
Clevo W230SS: amd64 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Fri Sep 25, 2015 9:55 pm    Post subject: Reply with quote

Fitzcarraldo wrote:
I wonder if unbinding the driver from the USB dvb stick then rebinding the driver to the stick would make the stick work again

This is one of the hints in the above mentioned post which I already tried.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Fri Sep 25, 2015 10:00 pm    Post subject: Reply with quote

mirekm wrote:
You can put the reset program in the cron, and reset your USB device when it still works

It is hard to decide about a timing, and it is unclear how it might help: Last time, the lock appeared already 1-2 hours after the last succesful test.
In the moment, it works since days...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum