LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices


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

Rep: Reputation: 0
How to power off USB port


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.
Old 01-13-2008, 01:58 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

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

Brian
 
Old 01-13-2008, 05:42 PM   #3
pyro
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.


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

Rep: Reputation: 74
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, 08:37 PM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
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.
 
Old 01-14-2008, 12:21 PM   #6
pyro
LQ Newbie
 
Registered: Feb 2002
Posts: 9

Original Poster
Rep: Reputation: 0
Hi,

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

Thanks

Pyro
 
Old 01-14-2008, 04:34 PM   #7
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,274

Rep: Reputation: 63
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, 10:21 AM   #8
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
/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 06:05 AM.
 
2 members found this post helpful.
Old 01-22-2014, 01:27 PM   #9
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 497

Rep: Reputation: 45
This thread is useful: https://stackoverflow.com/questions/...wer-on-and-off
 
  


Reply



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 03:02 AM
USB IR receivers supporting power on/off via mb power header dblade Linux - Hardware 0 09-16-2007 01:22 AM
which debian port for power edge 1800? kpachopoulos Debian 5 08-31-2007 12:11 PM
Parallel Port Power Off pete1234 Linux - General 4 03-02-2007 06:59 PM
no power to USB port? HailKingPhil Slackware 14 08-20-2004 09:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:39 PM.

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