2007-09-28 11:57:22

by Miguel

[permalink] [raw]
Subject: software unplug and plug USB

hi,

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?

The other problem is that this device is recognized like a cd rom
although I have patch my kernel 2.6.17. here is the var/messages:


Sep 28 12:53:41 ecar kernel: [17179613.972000] Vendor: HUAWEI
Model: Mass Storage Rev: 2.31
Sep 28 12:53:41 ecar kernel: [17179613.972000] Type: CD-ROM
ANSI SCSI revision: 02
Sep 28 12:53:41 ecar kernel: [17179613.996000] sr0: scsi3-mmc drive:
65x/349x xa/form2 cdda tray
Sep 28 12:53:41 ecar kernel: [17179613.996000] Uniform CD-ROM driver
Revision: 3.20


could anybody help me?

regards,

mike



2007-09-28 12:18:19

by Tomasz Chmielewski

[permalink] [raw]
Subject: Re: software unplug and plug USB

> 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 ;)


--
Tomasz Chmielewski
http://blog.wpkg.org

2007-10-01 07:36:42

by Miguel

[permalink] [raw]
Subject: Re: software unplug and plug USB

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?

On Fri, 2007-09-28 at 14:17 +0200, Tomasz Chmielewski wrote:
> > 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 ;)
>
>

2007-10-01 07:40:21

by Tomasz Chmielewski

[permalink] [raw]
Subject: Re: software unplug and plug USB

Miguel schrieb:
> 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...


> 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?


--
Tomasz Chmielewski
http://blog.wpkg.org

2007-10-01 08:18:46

by Miguel

[permalink] [raw]
Subject: Re: software unplug and plug USB

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)

On Mon, 2007-10-01 at 09:39 +0200, Tomasz Chmielewski wrote:
> Miguel schrieb:
> > 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...
>
>
> > 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?
>
>

2007-10-01 08:30:21

by Jiri Slaby

[permalink] [raw]
Subject: Re: software unplug and plug USB

On 10/01/2007 10:18 AM, Miguel wrote:
> 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,
--
Jiri Slaby ([email protected])
Faculty of Informatics, Masaryk University

2007-10-01 10:00:09

by Oliver Neukum

[permalink] [raw]
Subject: Re: software unplug and plug USB

Am Montag 01 Oktober 2007 schrieb 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 can use the bind & unbind attributes in sysfs.

Regards
Oliver

2007-10-01 10:05:24

by Tomasz Chmielewski

[permalink] [raw]
Subject: Re: software unplug and plug USB

Miguel schrieb:
> 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

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).


> 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?


--
Tomasz Chmielewski
http://blog.wpkg.org

2007-10-01 10:46:43

by Miguel

[permalink] [raw]
Subject: Re: software unplug and plug USB

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


On Mon, 2007-10-01 at 12:04 +0200, Tomasz Chmielewski wrote:
> ehci_hcd / uhci_hcd
> / ohci_hcd

2007-10-01 11:13:38

by Jiri Slaby

[permalink] [raw]
Subject: Re: software unplug and plug USB

On 10/01/2007 12:46 PM, Miguel wrote:
> 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?

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