再次关闭一个USB设备... [英] Turning off a single usb device... again

查看:133
本文介绍了再次关闭一个USB设备...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个话题已经讨论了很多次,但是没有一个答案对我有帮助。记录下来,我正在运行Debian。

I know that this topic has been discussed many times, but none of the answers helped me. For the record, i'm running Debian.

交易是:我买了一个USB供电的led灯,它非常简单,甚至没有开/关闭开关(它有效且始终处于打开状态)。我希望能够通过命令行打开/关闭它。这是我尝试的方法:

The deal is: I bought an usb powered led lamp, which is very simple and doesn't even have an on/off switch (it works and is always on). I want to be able to turn it on/off via command line. Here's what i tried:

    echo on > /sys/bus/usb/devices/usb1/power/level       # turn on
    echo suspend > /sys/bus/usb/devices/usb1/power/level  # turn off

这就是我已经在许多论坛上找到了。启用 on是有效的,但是 suspended会产生

which is what i've found on many forums. Turning "on" works, but "suspending" yields

    -su: echo: write error: Invalid argument

每一个usbN。我也尝试过

for every usbN. I also tried

    echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend_delay_ms"

错误,但也不执行任何操作(再次,对于每个usbN)

which doesn't give an error, but also doesn't do anything (again, for every usbN)

尝试

    echo "usb1" > /sys/bus/usb/drivers/usb/unbind

仅适用于更多智能设备,例如键盘,鼠标或USB wifi卡。我的意思是,只有tyhose设备处于关闭状态,其他usbN不会出错,但是指示灯永远不会熄灭。

works only for more "inteligent" devices, like the keyboard, the mouse, or the usb wifi card. What i mean is that only tyhose devices are turned off, other usbN don't give an error, but the lamp never goes off.

/ sys / bus的内容/ usb / devices /

the contents of /sys/bus/usb/devices/ are

    1-0:1.0 1-1:1.0 1-2:1.0 1-2:1.2 2-0:1.0 4-0:1.0 4-1:1.0 6-0:1.0 8-0:1.0 8-2:1.0 usb2 usb4 usb6 usb8
    1-1 1-2 1-2:1.1 1-2:1.3 3-0:1.0 4-1 5-0:1.0 7-0:1.0 8-2 usb1 usb3 usb5 usb7

我尝试做

    echo device_name > /sys/bus/usb/drivers/usb/unbind

,但每一个都只有一个设备usbN和NM进行反应,其形式为nm:xy yield

with every single one of them, but only the devices usbN and N-M react, the ones of the form n-m:x.y yield

    tee: /sys/bus/usb/drivers/usb/bind: No such device

(我尝试放入 1-0 :1.0, 1-0\:1.0和 1-0\:1.0,结果均相同。

(i tried putting in, for instance, "1-0:1.0", "1-0\:1.0" and "1-0\:1.0", all gave the same result).

最后一件事,执行后显示的内容

One last thing, what is shown after executing

    lsusb -t

当我插入或拔出灯泡时,它不会改变。

does not change when i plug or unplug the lamp.

有什么想法吗?

推荐答案

关闭设备ID 2-1:

Turn off device ID 2-1:

echo'2-1'| sudo tee / sys / bus / usb / drivers / usb / unbind

重新打开设备ID 2-1:

Turn device ID 2-1 back on:

echo'2-1'| sudo tee / sys / bus / usb / drivers / usb / bind

在我的情况下,使用设备ID 2-1控制USB记忆棒的电源,因此

In my case, using device ID 2-1 controls power to my usb stick, and as a consequence controls the light.


  • 提示:如果它们在Debian中为您工作,请为它们创建一个别名,以使您以后的生活更轻松。 / li>
  • TIP: If they work for you in Debian, create an alias for them to make life easier for you later.

希望有帮助,
Su

Hope this helps, Su

这篇关于再次关闭一个USB设备...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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