且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检测Linux中用于充电的USB端口?

更新时间:2023-02-27 08:10:51

无需花费大量精力(硬件或黑客),

Without significant effort (hardware or hacks), No.

您观察到的红色LED闪烁是Pi的功率监视器,指示当电流开始流向附件时电压突然下降.该LED指示灯指示电压(电能)已短暂下降到稳定水平以下,并且可能导致系统不稳定.

The red LED flash you observe is the power monitor for the Pi indicating a sudden voltage drop as current begins to flow to your accessory. This LED indicates voltage (electrical energy) has briefly dropped below stable levels, and system instability may result.

由于连接纯粹是在充电(没有与Pi交换USB数据),因此操作系统不知道该设备已连接.您可以构建一个外部电流测量电路来检测外围设备的汲取功率,但是在电子堆栈交换中***解决这个问题.

As the connection is purely charging (no USB data exchanged with the Pi) the operating system has no idea the device is connected. You could build an external current-measuring circuit to detect the peripheral drawing power, but such a question is better off in the electronics stack exchange.