Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 01-13-2008, 01:44 PM   #1
LQ Newbie
Registered: Feb 2002
Posts: 9

Rep: Reputation: 0
How to power off USB port

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

Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-13-2008, 02:58 PM   #2
LQ Guru
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
I guess you can try unloading the usb modules related to the device. Then reload them.

Old 01-13-2008, 06:42 PM   #3
LQ Newbie
Registered: Feb 2002
Posts: 9

Original Poster
Rep: Reputation: 0
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.

Old 01-13-2008, 06:46 PM   #4
Registered: Mar 2005
Location: North Carolina
Distribution: Arch
Posts: 977

Rep: Reputation: 73
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.
Old 01-13-2008, 09:37 PM   #5
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
There used to be something in sysfs for individual device power management. You could do something like:
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.
Old 01-14-2008, 01:21 PM   #6
LQ Newbie
Registered: Feb 2002
Posts: 9

Original Poster
Rep: Reputation: 0

I'm not sure if the USB port can be powered off by software, but it should get powered off, if the device consumes too much power.

I will try an older kernel next month. I don't have much spare time now.

Things aren't that easy anymore as they were with LPT


Old 01-14-2008, 05:34 PM   #7
Senior Member
Registered: Jul 2005
Distribution: Slackware
Posts: 1,219

Rep: Reputation: 54
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.
Old 07-26-2009, 11:21 AM   #8
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Buster (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
/sys/bus/usb/devices interface

You can power down a usb port (eg 1-2) by:

echo suspend >/sys/bus/usb/devices/1-2/power/level

and to turn it back on:

echo auto >/sys/bus/usb/devices/1-2/power/level

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 07:05 AM.
2 members found this post helpful.
Old 01-22-2014, 02:27 PM   #9
Registered: Apr 2011
Distribution: slackware64-current
Posts: 399

Rep: Reputation: 41
This thread is useful:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can more power be diverted to usb port ?? synapse Slackware 14 12-07-2007 04:02 AM
USB IR receivers supporting power on/off via mb power header dblade Linux - Hardware 0 09-16-2007 02:22 AM
which debian port for power edge 1800? kpachopoulos Debian 5 08-31-2007 01:11 PM
Parallel Port Power Off pete1234 Linux - General 4 03-02-2007 07:59 PM
no power to USB port? HailKingPhil Slackware 14 08-20-2004 10:33 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration