简体   繁体   English

带有 Windows 驱动程序的串行 USB 设备。 想在linux下使用

[英]Serial USB device with Windows drivers. Want to use it with linux

I have a GPS unit I can connect with USB, which is said by the manufacturer to be used with Windows.我有一个可以通过 USB 连接的 GPS 单元,制造商说它可以与 Windows 一起使用。 It has a CD with some drivers.它有一张带有一些驱动程序的 CD。 Something about USB to Serial PL2303.关于 USB 到串行 PL2303 的一些事情。

But I need to be able to use it with linux and python.但我需要能够在 linux 和 python 中使用它。 How can I go on about trying to achieve this?我该如何继续努力实现这一目标? Is it a lost cause when I have no documentation from manufacturer about which registers to read and such?当我没有制造商提供的关于要读取哪些寄存器等的文档时,这是一个失败的原因吗?

When I connect it is being recognized in dmesg, it gets a name /dev/ttyUSB1 What is the next step in trying to get this to work?当我连接它时,它在 dmesg 中被识别,它得到一个名称 /dev/ttyUSB1 尝试让它工作的下一步是什么?

The easiest way to do this is to use gpsd to read the data from the device.最简单的方法是使用gpsd从设备读取数据。 gpsd will automatically parse the messages from the GPS device and give you back the important information. gpsd 将自动解析来自 GPS 设备的消息,并将重要信息返回给您。 There are already Python bindings for you to get the information back, or you can fall back onto calling the C library from Python if that is required.已经有 Python 绑定供您获取信息,或者如果需要,您可以退回到从 Python 调用 C 库。

If you want to parse it yourself, it's likely the device is giving you out NMEA 0183 data.如果您想自己解析它,设备很可能会向您提供NMEA 0183数据。 The most likely default settings are going to be 4800-8-N-1 or 9600-8-N-1 .最有可能的默认设置是4800-8-N-19600-8-N-1 The easiest way that I have found to check devices such as this is to use GTKTerm to open up the serial port and see if the data is coming back properly.我发现检查此类设备的最简单方法是使用 GTKTerm 打开串行端口并查看数据是否正确返回。 Here's some sample data from a GPS receiver from USGlobalSat, running at 4800bps:以下是来自 USGlobalSat 的 GPS 接收器的一些示例数据,运行速度为 4800bps:

$GPGGA,,,,,,0,00,,,M,0.0,M,,0000*48
$GPGSA,M,1,,,,,,,,,,,,,,,*12
$GPGSV,3,1,12,01,00,000,,02,00,000,,03,00,000,,04,00,000,*7C
$GPGSV,3,2,12,05,00,000,,06,00,000,,07,00,000,,08,00,000,*77
$GPGSV,3,3,12,09,00,000,,10,00,000,,11,00,000,,12,00,000,*71
$GPRMC,,V,,,,,,,,,,N*53

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

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