FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-16-2009, 09:29 PM
 
Default reinserting USB plug via software

What commands would be the equivalent to pulling the USB connector out
of the computer, waiting a second, and then putting it back in?

I find that's what I have to do sometimes to get certain things to
work, and wish to reduce the wear and tear on the hardware.

> But wouldn't it be better to fix the underlying cause?

Yes, but please just tell me the commands.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-20-2009, 05:07 PM
"Stackpole, Chris"
 
Default reinserting USB plug via software

> From: jidanni@jidanni.org [mailto:jidanni@jidanni.org]
> Sent: Friday, January 16, 2009 4:29 PM
> Subject: reinserting USB plug via software
>
> What commands would be the equivalent to pulling the USB connector out
> of the computer, waiting a second, and then putting it back in?
>
> I find that's what I have to do sometimes to get certain things to
> work, and wish to reduce the wear and tear on the hardware.
>
> > But wouldn't it be better to fix the underlying cause?
>
> Yes, but please just tell me the commands.

Did you ever find a solution? I have some interest in this as well but
have not found one yet.

Have fun!
~Stack~


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-20-2009, 05:18 PM
Henrique de Moraes Holschuh
 
Default reinserting USB plug via software

On Tue, 20 Jan 2009, Stackpole, Chris wrote:
> > What commands would be the equivalent to pulling the USB connector out
> > of the computer, waiting a second, and then putting it back in?

rmmod uhci-hcd; rmmod ehci-hcd; sleep 1; modprobe ehci-hcd;
modprobe uhci-hcd

(you may also need ohci-hcd, but the above is the most common setup)

If you do something stupid with that, like running it with usb-storage
filesystems mounted, and the kernel happens to let you do it, you may suffer
data-loss. You have been warned. It will bring down (logically) all USB
buses, then bring them up again.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 02:27 AM
Stefan Monnier
 
Default reinserting USB plug via software

>> > What commands would be the equivalent to pulling the USB connector out
>> > of the computer, waiting a second, and then putting it back in?

> rmmod uhci-hcd; rmmod ehci-hcd; sleep 1; modprobe ehci-hcd;
> modprobe uhci-hcd

> (you may also need ohci-hcd, but the above is the most common setup)

> If you do something stupid with that, like running it with usb-storage
> filesystems mounted, and the kernel happens to let you do it, you may suffer
> data-loss. You have been warned. It will bring down (logically) all USB
> buses, then bring them up again.

And of course, it may not be sufficient: my rt73usb wifi dongle seems to
require a unplug-replug after hibernation to bring it back to life.
No amount of "modprobe -r" seems to be able to fix it.


Stefan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 06:40 PM
"Stackpole, Chris"
 
Default reinserting USB plug via software

> From: Henrique de Moraes Holschuh [mailto:hmh@debian.org]
> Sent: Tuesday, January 20, 2009 12:19 PM
> Subject: Re: reinserting USB plug via software
>
> On Tue, 20 Jan 2009, Stackpole, Chris wrote:
> > > What commands would be the equivalent to pulling the USB connector
out
> > > of the computer, waiting a second, and then putting it back in?
>
> rmmod uhci-hcd; rmmod ehci-hcd; sleep 1; modprobe ehci-hcd;
> modprobe uhci-hcd
>
> (you may also need ohci-hcd, but the above is the most common setup)
>
> If you do something stupid with that, like running it with usb-storage
> filesystems mounted, and the kernel happens to let you do it, you may
> suffer
> data-loss. You have been warned. It will bring down (logically) all
USB
> buses, then bring them up again.

Wait. It will bring down _all_ USB buses? Hrm. I think I will just stick
with unplugging and plugging it back in. I just have an external hard
drive that refuses to go into standby mode/sleep unless I unmount it.
However, once it goes to sleep, I haven't been able to bring it out of
sleep unless I unplug and plug it back in. It is annoying to have to
stand up and go to the computer to mess around with it when I need it,
but since I rarely use it that alternative is slightly less annoying
then having it constantly whirring.

Thanks anyway though! It is another set of commands that I will have to
remember.

~Stack~



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 07:07 PM
Tzafrir Cohen
 
Default reinserting USB plug via software

On Wed, Jan 21, 2009 at 01:40:04PM -0600, Stackpole, Chris wrote:
> > From: Henrique de Moraes Holschuh [mailto:hmh@debian.org]
> > Sent: Tuesday, January 20, 2009 12:19 PM
> > Subject: Re: reinserting USB plug via software

> > rmmod uhci-hcd; rmmod ehci-hcd; sleep 1; modprobe ehci-hcd;
> > modprobe uhci-hcd
> >
> > (you may also need ohci-hcd, but the above is the most common setup)
> >
> > If you do something stupid with that, like running it with usb-storage
> > filesystems mounted, and the kernel happens to let you do it, you may
> > suffer data-loss. You have been warned. It will bring down
> > (logically) all USB buses, then bring them up again.
>
> Wait. It will bring down _all_ USB buses? Hrm. I think I will just stick
> with unplugging and plugging it back in.

Alternatively: rmmod usb_storage

(but this will also disconnect other USB disks)

See also the following:
http://blog.andrew.net.au/2009/01/17#usb_power_control2
Maybe it will provide you some hints, though it seems to deal with
devices that are USB hubs themselves.

--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-23-2009, 05:55 PM
 
Default reinserting USB plug via software

Gentlemen, thank you for your answers. I have perfected:
$ cat usb-reset
#!/bin/sh
mount|grep /dev/sd && { echo 1>&2 $0: umount it first, Holmes; exit 55;}
grep uhci_hcd /proc/modules > /dev/null
case $? in 0) m=u;; 1) m=o;; esac
set -e
for i in rmmod modprobe
do for j in ${m?}hci-hcd ehci-hcd
do $i $j
done
sleep 1
done


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-23-2009, 06:57 PM
"Boyd Stephen Smith Jr."
 
Default reinserting USB plug via software

On Friday 2009 January 23 12:55:23 jidanni@jidanni.org wrote:
>I have perfected:

Bold claim!

>$ cat usb-reset
>#!/bin/sh
>mount|grep /dev/sd && { echo 1>&2 $0: umount it first, Holmes; exit 55;}

It will always error on both of my systems, having /dev/sda1 (internal SATA
drive) mounted as /boot.

>grep uhci_hcd /proc/modules > /dev/null
>case $? in 0) m=u;; 1) m=o;; esac

How about:
m=o; grep -q uhci_hcd /proc/modules && m=u
which does mostly the same thing.

Also, this falls apart on my desktop that needs all *three* usb modules loaded
for all the ports to work. (Yes, this did cause me no end to trouble as uhci
and ohci have not always played as well together as they do now.)

Not perfect, but quite usable.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
 

Thread Tools




All times are GMT. The time now is 07:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org