Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
is it possible to power off a USB port by software?
The problem is my USB UMTS modem which hangs from time to time. The router with the modem should be placed under the roof, so you can't just remove the modem and plug it in again. It would be possible to reboot the whole machine, but isn't there a clean solution?
Thanks in advance
Pyro
Click here to see the post LQ members have rated as the most helpful post in this thread.
The problem is the firmware of the device, if the device hangs, unloading the module won't help.
I have to reset the device, so switching off the USB port would be the safest way.
I'm not sure this is possible, there seems to always be power going to the USB port when the system is on, it doesn't appear to be software controllable. If you are going to be putting this somewhere where it would be hard to reset manually, the obvious option would be to get a good modem that doesn't require this.
There used to be something in sysfs for individual device power management. You could do something like:
Code:
echo "2" > /sys/path/to/device/power/state
To reduce the power to power state “2”. The problem was that it only worked correctly for a few devices. Also, it was not clear what the power states meant across all types of devices on all types of buses. As of July 2007, this feature has been removed from the linux kernel, and AFAIK, there is no pending replacement.
Perhaps you could put a hub between the root usb port and the device. Then when the device hangs you can try to reset the hub or move the modem to another port on the hub. Other than that I would have to agree with elliott678. The closest thing you can do without an actual shutdown/restart would be to unload the modules for usb_ehci, or usb_ohci depending on your setup, as long as they're not builtin to the kernel. Check the output of lsmod.
However, my understanding is that the suspend is done by the slave device, so if it has hung, it is possible it might not suspend. Likewise, this cannot be used to turn off a usb parasitic device (usb lights and the like), which have no communications interface.
A usb master can turn off power if too much current is drawn by the device, but I don't know if this power control can be done from software (might depend on the particular chips being used).
Last edited by neonsignal; 07-27-2009 at 06:05 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.