Skip to contentSkip to conversation

Cut power to a USB port?

DISCUSSION Andrew Barr 4 participants 6 messages Jan 1, 2007 – Jan 2, 2007

lore
Share & tools
lore
#0 lore raw

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

Thanks in advance,
Andrew Barr

Please CC any replies

#1 lore raw

Am Montag, 1. Januar 2007 21:56 schrieb Andrew Barr:

Quoted 5 lines

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I

You could use usbfs to send commands to the hub.

Quoted 3 lines

know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

The ability to cut each port's power individually is optional. Your hardware may well be incapable of what you want.

Regards
Oliver

#2 lore raw
In reply to Andrew Barr
Quoted 8 lines · Andrew Barr

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

Search the archives of the linux-usb-devel mailing list for a program that might do this for you (depending on your hardware.)

good luck,

greg k-h

#3 lore raw
Quoted 10 lines · Greg KH
Quoted 8 lines · Andrew Barr

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

Quoted 2 lines

Search the archives of the linux-usb-devel mailing list for a program that might do this for you (depending on your hardware.)

What search terms should I use? Searching on "power" and "port power" at Gmane in the gmane.linux.usb.devel group doesn't readily give me anything.

For the record, my hardware:

00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)

IBM Thinkpad R51 2883-ELU.

Regards,
Andrew

Quoted 3 lines

good luck,

greg k-h

#4 lore raw
Quoted 11 lines · On Tue, 02 Jan 2007 10:28:38 -0500 Andrew Barr wrote:
Quoted 10 lines · Greg KH
Quoted 8 lines · Andrew Barr

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

Quoted 6 lines
Quoted 2 lines

Search the archives of the linux-usb-devel mailing list for a program that might do this for you (depending on your hardware.)

What search terms should I use? Searching on "power" and "port power" at Gmane in the gmane.linux.usb.devel group doesn't readily give me anything.

You can try:

usbpoweroff.c
(http://www.informatik.uni-halle.de/~ladischc/usbpoweroff.c)
or
hub-ctrl-2.c (http://www.gniibe.org/log/linux)

Quoted 11 lines

For the record, my hardware:

00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)

Quoted 1 line

IBM Thinkpad R51 2883-ELU.

---
~Randy

#5 lore raw
Quoted 20 lines · Randy Dunlap
Quoted 11 lines · On Tue, 02 Jan 2007 10:28:38 -0500 Andrew Barr wrote:
Quoted 10 lines · Greg KH
Quoted 8 lines · Andrew Barr

I have a simple question perhaps someone can help me with here...

I have one of those simple LED keyboard lamps that get their power from the USB port. Is there some way in Linux, using files under /sys I would imagine, to cut power to the USB port into which this lamp is plugged? I know I would have to manually figure out what port it's plugged into, as it is not a "real" USB device...e.g. it just draws power. I would like to be able to programmatically switch the lamp on and off.

Quoted 6 lines
Quoted 2 lines

Search the archives of the linux-usb-devel mailing list for a program that might do this for you (depending on your hardware.)

What search terms should I use? Searching on "power" and "port power" at Gmane in the gmane.linux.usb.devel group doesn't readily give me anything.

Quoted 6 lines

You can try:

usbpoweroff.c
(http://www.informatik.uni-halle.de/~ladischc/usbpoweroff.c)
or
hub-ctrl-2.c (http://www.gniibe.org/log/linux)

Hm, my hardware must not support it. The hub-ctrl-2.c program fails with a broken pipe and the usbpoweroff.c program silently does nothing, exiting returning zero.

Thanks to you all anyway,
Andrew

Quoted 16 lines
Quoted 11 lines

For the record, my hardware:

00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)

Quoted 1 line

IBM Thinkpad R51 2883-ELU.

---
~Randy