Skip to contentSkip to conversation

Software based unplug of USB device?

DISCUSSION Joerg Pommnitz 4 participants 4 messages May 3, 2004 – May 4, 2004

lore
Share & tools
lore
#0 lore raw

Hello listees,
we are struggling with a 3rd party USB device. It comes with its own firmware and its own Linux USB serial drivers. Unfortunately the communication between the device and the user application seems to break down from time to time. This situation can easily be resolved by unplugging and then re-plugging the device. Unfortunately this requires manual intervention.
While resolving the real issue would be the preferred way to deal with this problem, we would settle for a way to do a software unplug/re-plug. Can this be done at all? If so, is there a tool to do this?

A detailed description of our environment:
* Linux 2.4.21 with USB OHCI driver
* Natsemi Geode integrated CPU/Chipset

Thanks in advance
Joerg

Mit schönen Grüßen von Yahoo! Mail - http://mail.yahoo.de

#1 lore raw
Quoted 3 lines · Joerg Pommnitz

Hello listees,
we are struggling with a 3rd party USB device. It comes with its own firmware and its own Linux USB serial drivers.

Which device and driver is this? Do you have a pointer to the driver?

Quoted 7 lines

Unfortunately the
communication between the device and the user application seems to break down from time to time. This situation can easily be resolved by unplugging and then re-plugging the device. Unfortunately this requires manual intervention.
While resolving the real issue would be the preferred way to deal with this problem, we would settle for a way to do a software unplug/re-plug.

Do you want to do this from within the kernel, or from userspace? If from within the kernel, you should be able to drop the power to a hub port and reenable it, but I haven't checked to see if that works in a long time.

thanks,

greg k-h

#2 lore raw
Quoted 15 lines · Greg KH
Quoted 3 lines · Joerg Pommnitz

Hello listees,
we are struggling with a 3rd party USB device. It comes with its own firmware and its own Linux USB serial drivers.

Which device and driver is this? Do you have a pointer to the driver?

Quoted 7 lines

Unfortunately the
communication between the device and the user application seems to break down from time to time. This situation can easily be resolved by unplugging and then re-plugging the device. Unfortunately this requires manual intervention.
While resolving the real issue would be the preferred way to deal with this problem, we would settle for a way to do a software unplug/re-plug.

Quoted 4 lines

Do you want to do this from within the kernel, or from userspace? If from within the kernel, you should be able to drop the power to a hub port and reenable it, but I haven't checked to see if that works in a long time.

Wouldn't usb_reset_device() work? That's assuming the device isn't totally and completely hosed.

It can be done via usbfs as well.

JE

#3 lore raw
In reply to Joerg Pommnitz
Quoted 11 lines · Joerg Pommnitz

Hello listees,
we are struggling with a 3rd party USB device. It comes with its own firmware and its own Linux USB serial drivers. Unfortunately the communication between the device and the user application seems to break down from time to time. This situation can easily be resolved by unplugging and then re-plugging the device. Unfortunately this requires manual intervention.
While resolving the real issue would be the preferred way to deal with this problem, we would settle for a way to do a software unplug/re-plug. Can this be done at all? If so, is there a tool to do this?

Quoted 3 lines

A detailed description of our environment:
* Linux 2.4.21 with USB OHCI driver
* Natsemi Geode integrated CPU/Chipset

This can be done in a number of ways:
(1) unload and reload the module driving the usb device. This should disconnect it from the device and reconnect it when reloaded.
(2) restart the hotplug system (this will disconnect and reconnect all devices).
(3) use usbfs: there is an ioctl to disconnect a kernel driver from a device, and another to reconnect it.

I hope this helps,

Duncan.