简体   繁体   English

通过USB的Linux串行设备服务器?

[英]Linux Serial Device Server over USB?

I have an embedded Linux solution and want to create a command service over serial USB. 我有一个嵌入式Linux解决方案,并希望通过串行USB创建命令服务。 The idea being that when a computer connects to my embedded via USB, they see a serial device and send serial commands to me through that port and I send responses back. 想法是,当计算机通过USB连接到我的嵌入式设备时,他们会看到一个串行设备,并通过该端口向我发送串行命令,然后我将响应发送回去。

I need some help in the direction to proceed. 我需要一些指导以继续前进。 Do I need to emulate a serial device so they see me as a COM port? 我是否需要模拟串行设备,以便他们将我视为COM端口? Is there build in Linux solutions to broadcast my details as a serial device? 是否有内置的Linux解决方案可以将我的详细信息作为串行设备广播? Are there code examples? 有代码示例吗? I can see block devices connect with my embedded solution like a USB storage device. 我可以看到块设备与我的嵌入式解决方案相连,例如USB存储设备。 When I plug into another computer, I would like it to see me as a serial COM port. 当我插入另一台计算机时,希望将其视为串行COM端口。

I just need help in the direction of which path I should go down to solve this. 我只需要帮助我确定应该解决的路径。

Thanks in advance. 提前致谢。

What you are looking for is the Linux USB serial gadget . 您正在寻找的是Linux USB串行小工具 The Linux USB gadgets framework allows devices to behave as a variety of standard USB devices, including serial devices, Ethernet adapters, and mass storage devices. Linux USB小工具框架允许设备充当各种标准USB设备,包括串行设备,以太网适配器和大容量存储设备。

Note that USB gadgets will only work on targets with a USB controller that can be set to operate as a USB device. 请注意,USB小工具只能在带有USB控制器的目标上使用,该USB控制器可以设置为充当USB设备。 Not all USB controllers and target devices are compatible with this configuration. 并非所有USB控制器和目标设备都与此配置兼容。 For instance, most PCs have a host-only USB controller, and the Raspberry Pi Model B is not compatible with gadgets because it contains an embedded USB hub upstream of the USB ports. 例如,大多数PC都具有仅主机的USB控制器,并且Raspberry Pi Model B与小工具兼容,因为它在USB端口的上游包含嵌入式USB集线器。 (However, the Pi Zero is fully compatible with gadgets .) (但是, Pi Zero与小工具完全兼容 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM