如何在 Ubuntu 中关闭 USB 灯?

Fel*_*hes 5 usb devices power-management

我买了一个 USB 灯,我想使用命令打开/关闭它(我的目的是设置一些 CRON 作业以在特定时间打开它)。

\n

我研究了几个答案,但没有一个有效。

\n

我尝试使用所有 USB 端口(包括 USB 集线器中的端口等)输出到 、 工具,但没有任何/sys/bus/usb/drivers/usb/unbind效果/sys/bus/usb/devices/usb1/power/leveluhubctl

\n

该灯是一个哑设备,当它插入端口时它就会打开。

\n

我的电脑是MouseComputer Co.,Ltd. MB-R500.

\n

灯就是这个

\n
lsb_release -a\n\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription:    Ubuntu 22.04.3 LTS\nRelease:        22.04\nCodename:       jammy\n
Run Code Online (Sandbox Code Playgroud)\n
sudo lsusb\nBus 002 Device 004: ID 2109:0813 VIA Labs, Inc. VL813 Hub\nBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub\nBus 001 Device 123: ID 13d3:56af IMC Networks USB2.0 HD UVC WebCam\nBus 001 Device 121: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller\nBus 001 Device 119: ID 2808:9338 Focal-systems.Corp FT9201Fingerprint.\xcc\x9a\nBus 001 Device 054: ID 19d2:1405 ZTE WCDMA Technologies MSM ZTE Technologies MSM\nBus 001 Device 053: ID 046d:c52b Logitech, Inc. Unifying Receiver\nBus 001 Device 052: ID 046d:c548 Logitech, Inc. USB Receiver\nBus 001 Device 051: ID 2109:2813 VIA Labs, Inc. VL813 Hub\nBus 001 Device 125: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\n
Run Code Online (Sandbox Code Playgroud)\n
sudo uhubctl\nCurrent status for hub 2-2 [2109:0813 VIA Labs, Inc. USB3.0 Hub, USB 3.00, 4 ports, ppps]\n  Port 1: 02a0 power 5gbps Rx.Detect\n  Port 2: 02a0 power 5gbps Rx.Detect\n  Port 3: 02a0 power 5gbps Rx.Detect\n  Port 4: 02a0 power 5gbps Rx.Detect\nCurrent status for hub 1-2 [2109:2813 VIA Labs, Inc. USB2.0 Hub, USB 2.10, 4 ports, ppps]\n  Port 1: 0100 power\n  Port 2: 0103 power enable connect [046d:c548 Logitech USB Receiver]\n  Port 3: 0103 power enable connect [046d:c52b Logitech USB Receiver]\n  Port 4: 0503 power highspeed enable connect [19d2:1405 ZTE,Incorporated ZTE Technologies MSM MF9751ZTED000000]\n
Run Code Online (Sandbox Code Playgroud)\n

这是输出的片段lsusb -v,然后搜索Anker哪个是我的HUB的名称。

\n
Bus 001 Device 068: ID 291a:8365 Anker                   Anker USB-C Hub Device\nDevice Descriptor:\n  bLength                18\n  bDescriptorType         1\n  bcdUSB               2.01\n  bDeviceClass           17\n  bDeviceSubClass         0\n  bDeviceProtocol         0\n  bMaxPacketSize0        64\n  idVendor           0x291a\n  idProduct          0x8365\n  bcdDevice            0.01\n  iManufacturer           1 Anker\n  iProduct                2 Anker USB-C Hub Device\n  iSerial                 3 0000000000000001\n  bNumConfigurations      1\n  Configuration Descriptor:\n    bLength                 9\n    bDescriptorType         2\n    wTotalLength       0x0012\n    bNumInterfaces          1\n    bConfigurationValue     1\n    iConfiguration          3 0000000000000001\n    bmAttributes         0xe0\n      Self Powered\n      Remote Wakeup\n    MaxPower              100mA\n    Interface Descriptor:\n      bLength                 9\n      bDescriptorType         4\n      bInterfaceNumber        0\n      bAlternateSetting       0\n      bNumEndpoints           0\n      bInterfaceClass        17\n      bInterfaceSubClass      0\n      bInterfaceProtocol      0\n      iInterface              3 0000000000000001\n
Run Code Online (Sandbox Code Playgroud)\n

Fel*_*hes 3

我能够把它关掉。解决方案:

  1. 购买一个支持端口电源切换的USB HUB。大多数人都没有,所以在购买之前要好好研究一下。
  2. 使用该uhubctl工具(使用 进行安装sudo apt install uhubctl)。

我买的HUB就是这个(System Talks出品的Sugoi HUB,型号:USB2-HUB4X-BK)。我不确定它是否仍在生产,但还有其他可以工作的(这是受支持的集线器的非详尽列表)。

就我而言,我使用此命令(阅读文档)来切换开/关:

sudo uhubctl -l 1-1 -p 1 -a toggle
Run Code Online (Sandbox Code Playgroud)

显然,其他设置的数字会有所不同。