Skip to contentSkip to conversation

software unplug and plug USB

DISCUSSION Tomasz Chmielewski 4 participants 9 messages Sep 28, 2007 – Oct 1, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

I'm using a huawei E220 modem and occasionally it doesn't work and I must unplug and plug it again, run the scripts connection to make it works again.
how can I unplug an plug an USB modem via software?

If the modem doesn't have any other power sources than USB, just removing the modem's and USB modules, and the modprobing them again should help.

Just take care if you have it connected to the PC with a USB keyboard ;)

Signature · 2 lines
Tomasz Chmielewski
http://blog.wpkg.org
#1 lore raw

actually, I have a USB keyboard, could that be the problem? why?

removing and adding modules doesn't solve my problem... The USB has several functions: modem and usb mass storage and only the storage one is recognized
:(

any thoughts?

Quoted 12 lines · Tomasz Chmielewski
Quoted 4 lines

I'm using a huawei E220 modem and occasionally it doesn't work and I must unplug and plug it again, run the scripts connection to make it works again.
how can I unplug an plug an USB modem via software?

If the modem doesn't have any other power sources than USB, just removing the modem's and USB modules, and the modprobing them again should help.

Just take care if you have it connected to the PC with a USB keyboard ;)

#2 lore raw
Quoted 1 line · Miguel

actually, I have a USB keyboard, could that be the problem? why?

Because when you remove USB modules, USB devices, including USB keyboards, won't work...

Quoted 3 lines

removing and adding modules doesn't solve my problem... The USB has several functions: modem and usb mass storage and only the storage one is recognized :(

What modules exactly do you unload/load again, in what order, using which commands?

Signature · 2 lines
Tomasz Chmielewski
http://blog.wpkg.org
#3 lore raw

I also have a mobile phone connected, a gps and a keyboard, i do the following:

ecar@ecar:~$ lsmod | grep usb
usbserial              29928  1 pl2303
usbtouchscreen          8708  0 
usbcore               130304  7
libusual,pl2303,usbserial,usbtouchscreen,ehci_hcd,uhci_hcd
ecar@ecar:~$ rmmod pl2303
ERROR: Removing 'pl2303': Operation not permitted
ecar@ecar:~$ sudo rmmod pl2303
ecar@ecar:~$ sudo rmmod usbserial
ecar@ecar:~$ modprobe usbserial
FATAL: Error inserting usbserial
(/lib/modules/2.6.17-11-386/kernel/drivers/usb/serial/usbserial.ko):
Operation not permitted
(reverse-i-search)`mod': cd backup_modules/
(reverse-i-search)`modpro': sudo modprobe  ehci_hcd
ecar@ecar:~$ sudo modprobe usbserial vendor=0x12d1 product=0x1003
ecar@ecar:~$ lsmod | grep usb
usbserial              29928  0 
usbtouchscreen          8708  0 
usbcore               130304  6
usbserial,libusual,usbtouchscreen,ehci_hcd,uhci_hcd

but only when I unplug and plug manually, the modem starts up ... Because of that i wanted to unplug/plug via scripting (software way)

Quoted 16 lines · Tomasz Chmielewski
Quoted 1 line · Miguel

actually, I have a USB keyboard, could that be the problem? why?

Because when you remove USB modules, USB devices, including USB keyboards, won't work...

Quoted 4 lines

removing and adding modules doesn't solve my problem... The USB has several functions: modem and usb mass storage and only the storage one is recognized
:(

What modules exactly do you unload/load again, in what order, using which commands?

#4 lore raw
Quoted 2 lines · Miguel

but only when I unplug and plug manually, the modem starts up ... Because of that i wanted to unplug/plug via scripting (software way)

You might try this (bottom of the page):
http://lkml.org/lkml/2007/5/28/193

regards,

Signature · 2 lines
Jiri Slaby ([email protected])
Faculty of Informatics, Masaryk University
#5 lore raw
In reply to Miguel

Am Montag 01 Oktober 2007 schrieb Miguel:

Quoted 2 lines

but only when I unplug and plug manually, the modem starts up ... Because of that i wanted to unplug/plug via scripting (software way)

You can use the bind & unbind attributes in sysfs.

Regards
Oliver

#6 lore raw
In reply to Miguel
Quoted 4 lines · Miguel

I also have a mobile phone connected, a gps and a keyboard, i do the following:

Quoted 8 lines
ecar@ecar:~$ lsmod | grep usb
usbserial              29928  1 pl2303
usbtouchscreen          8708  0 usbcore               130304  7
libusual,pl2303,usbserial,usbtouchscreen,ehci_hcd,uhci_hcd
ecar@ecar:~$ rmmod pl2303
ERROR: Removing 'pl2303': Operation not permitted
ecar@ecar:~$ sudo rmmod pl2303
ecar@ecar:~$ sudo rmmod usbserial

Only then It's not enough. You also have to remove ehci_hcd / uhci_hcd
/ ohci_hcd.the device will be powered off (unless the method described in the link given by Jiri Slaby powers the device off, too).

Quoted 5 lines
ecar@ecar:~$ modprobe usbserial
FATAL: Error inserting usbserial
(/lib/modules/2.6.17-11-386/kernel/drivers/usb/serial/usbserial.ko):
Operation not permitted
(reverse-i-search)`mod': cd backup_modules/

cd backup_modules/? Where do you keep your modules?

Signature · 2 lines
Tomasz Chmielewski
http://blog.wpkg.org
#7 lore raw

if I remove ehci_hcd / uhci_hcd / ohci_hcd , some other devices like touchscreen, GPS and keyboard could stop working.

backup_modules doesn't matter here, is my personal backup. I have tried also to recompile some modules because some times my modem huaweis is recognized like usb mass storage.

I will try a how to guide to do what oliver commented

"You can use the bind & unbind attributes in sysfs"

where can i find information about that?

kindest regards

Quoted 2 lines · Tomasz Chmielewski

ehci_hcd / uhci_hcd
/ ohci_hcd

#8 lore raw
Quoted 7 lines · Miguel

if I remove ehci_hcd / uhci_hcd / ohci_hcd , some other devices like touchscreen, GPS and keyboard could stop working.

backup_modules doesn't matter here, is my personal backup. I have tried also to recompile some modules because some times my modem huaweis is recognized like usb mass storage.

Quoted 5 lines

I will try a how to guide to do what oliver commented

"You can use the bind & unbind attributes in sysfs"

where can i find information about that?

gee, here:
http://lkml.org/lkml/2007/5/28/193