使用Linux控制USB电源(开/关) [英] Controlling a USB power supply (on/off) with Linux

查看:172
本文介绍了使用Linux控制USB电源(开/关)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Linux上通过USB手动打开/关闭电源?

Is it possible to turn on/off power supplies from USB manually with Linux?

有一个外部USB冷却风扇(您用来冷却自己而不是PC的那种),能够从终端进行控制很好,因为我想将风扇放置在较远的地方.

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.

我想这也可能对许多其他事情也有用,因为那里有很多USB玩具.也许是空气净化器,等等.(我听说它们并没有真正起作用).

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).

推荐答案

注意..此答案中的信息与较早的内核(最高2.6.32)相关.有关较新内核的信息,请参见 tlwhitec的答案.

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

(您可能需要将usb1更改为usb n )

(You may need to change usb1 to usb n)

来源:Documentation/usb/power-management.txt.gz

Source: Documentation/usb/power-management.txt.gz

这篇关于使用Linux控制USB电源(开/关)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆