【发布时间】:2020-06-30 12:22:03
【问题描述】:
Linux中如何控制连接到USB端口的继电器(一个通道)?
将继电器连接到 USB 端口时,继电器会持续开启。但是在终端执行 lsusb 时,系统找不到设备。
连接前的lusb输出:
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 1358:c123
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 13d3:56f9 IMC Networks
Bus 001 Device 004: ID 27c6:5110
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 002: ID 0458:0189 KYE Systems Corp. (Mouse Systems)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
连接设备的lusb:
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 1358:c123
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 13d3:56f9 IMC Networks
Bus 001 Device 004: ID 27c6:5110
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 002: ID 0458:0189 KYE Systems Corp. (Mouse Systems)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[更新]
这是 dmesg 的输出:
[ 3975.045806] usb 1-3: new low-speed USB device number 23 using xhci_hcd
[ 3975.657743] usb 1-3: new low-speed USB device number 24 using xhci_hcd
[ 3976.801721] usb 1-3: new low-speed USB device number 25 using xhci_hcd
[ 3977.345746] usb 1-3: new low-speed USB device number 26 using xhci_hcd
[ 3977.761777] usb usb1-port3: unable to enumerate USB device
感谢您的任何建议。
您好!
【问题讨论】:
-
我解决问题的第一个方法是识别端口上的中继,因为我在此页面 (digital-loggers.com/iotfaqs.html) 中找到了一个小代码,您可以在其中看到如何使用端口的物理方向。谢谢。
-
代码不存在,只问我为什么操作系统没有检测到连接的继电器,但BallisticTomato消除了我的疑惑。感谢您的关注。
标签: c embedded-linux libusb relay usbserial