Controlling a USB power supply (on/off) with linux
Controlling a USB power supply (on/off) with linux
Is it possible to turn on/off power supplies from USB manually with linux?
There's this external USB cooling fan (the kind you use to cool yourself off, not the PC), and it would be nice to be able to control it from the terminal, because I want to position the fan somewhere far away.
I suppose this could also be useful for a variety of other things as well, because there's a lot of USB toys out there. Maybe air purifiers etc (I heard they don't really work though).
Answer by Roman Cheplyaka for Controlling a USB power supply (on/off) with linux
Note. The information in this answer is relevant for the older kernels (up to 2.6.32). See tlwhitec's answer for the information on the newer kernels.
# disable external wake-up; do this only once echo disabled > /sys/bus/usb/devices/usb1/power/wakeup echo on > /sys/bus/usb/devices/usb1/power/level # turn on echo suspend > /sys/bus/usb/devices/usb1/power/level # turn off
(You may need to change usb1 to usb n)
Source: Documentation/usb/power-management.txt.gz
Answer by Carles for Controlling a USB power supply (on/off) with linux
I wanted to do this, and with my USB hardware I couldn't. I wrote a hacky way how to do it here: http://pintant.cat/2012/05/12/power-off-usb-device/ . In short way: I used a USB relay to open/close the Vc of another USB cable...
Answer by tlwhitec for Controlling a USB power supply (on/off) with linux
According to the docs, there were several changes to the USB power management from kernels 2.6.32, which seem to settle in 2.6.38. Now you'll need to wait for the device to become idle, which is governed by the particular device driver. The driver needs to support it, otherwise the device will never reach this state. Unluckily, now the user has no chance to force this. However, if you're lucky and your device can become idle, then to turn this off you need to:
echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend" echo "auto" > "/sys/bus/usb/devices/usbX/power/level"
or, for kernels around 2.6.38 and above:
echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend_delay_ms" echo "auto" > "/sys/bus/usb/devices/usbX/power/control"
This literally means, go suspend at the moment the device becomes idle.
So unless your fan is something "intelligent" that can be seen as a device and controlled by a driver, you probably won't have much luck on current kernels.
Answer by grandrew for Controlling a USB power supply (on/off) with linux
I have found these solutions that at least work for properly configured Terminus FE 1.1 USB hub chip:
1.To turn off power on all USB ports of a hub, you may unbind the hub from kernel using:
echo "1-4.4.4" > /sys/bus/usb/drivers/usb/unbind
to turn power back on - you may bind it back using
echo "1-4.4.4" > /sys/bus/usb/drivers/usb/bind
2.Switching power at each port individually is trickier: I was able to use hubpower to control each port - but it comes with a downside: hubpower first disconnects the usbdevfs wich causes all of the USB devices to disconect from system, at least on ubuntu:
usb_ioctl.ioctl_code = USBDEVFS_DISCONNECT; rc = ioctl(fd, USBDEVFS_IOCTL, &usb_ioctl);
With this ioctl
disabled I was able to switch off individual port power without detaching all devices - but the power goes back on immediately (probably due to kernel seeing an uninitialized device) which causes USB device just to do a "cold restart" which is what I generally wanted to do. My patched hubpower is here
Answer by user3527264 for Controlling a USB power supply (on/off) with linux
echo '2-1' |sudo tee /sys/bus/usb/drivers/usb/unbind
works for ubuntu
Answer by Dominic Cerisano for Controlling a USB power supply (on/off) with linux
PowerTOP from Intel allows you to toggle power to attached usb devices in real-time. These are called "tunables".
sudo apt-get-install powertop sudo powertop
- Tab over to 'tunables'.
- Scroll down to your usb device.
- Hit enter to toggle power saving mode (good=on, bad=off)
See the PowerTOP blogs for details on how to make these changes permanent. It generates the configs for you to install (pretty much as described by other posters on this thread).
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
0 comments:
Post a Comment