Linux上的Ada GNAT.Serial_Communications行为 [英] Ada GNAT.Serial_Communications behavior on Linux

查看:86
本文介绍了Linux上的Ada GNAT.Serial_Communications行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ada程序,该程序与通过USB连接的Intellibox Basic(允许您控制火车的盒子)进行通信。

I have an Ada program that communicates with an Intellibox Basic(a box that allows you to control trains) that is connected via USB.

在Windows下,我有安装特定的串行驱动程序(CP210x USB至UART桥接器VCP)。有了那个驱动程序,我就可以与盒子完美交流。

Under Windows, I had to install a specific Serial driver (CP210x USB to UART Bridge VCP). With that driver I can communicate perfectly with the box. That means sending commands to the box.

在Linux下,我通过 / dev / ttyusb0 进行通信,能够从包装盒中获取消息,但是我无法将命令发送到包装盒。什么都没发生。我没有收到任何错误。

Under Linux I'm communicating via /dev/ttyusb0 and I'm able to get messages from the box, but I can't send commands to the box. Nothing happens. I don't get an error or something.

在Linux上GNAT.SerialCommunication的行为是否有所不同?程序是一样的。我是否需要设置某些条件才能使其在Linux上工作?

Is the behavior of GNAT.SerialCommunication differently on Linux ? The program is the same. Do I have to setup certain things to get it to work on Linux ?

例如:一个典型的2字节命令将Command作为第一个字节,并将CRC检查作为第二个。

For example: A typical 2-byte command has the Command as the first Byte and the CRC check as the second one.

推荐答案

在某些时候我遇到了Serial_Communication的麻烦,事实证明这是在Linux中启用硬件握手的问题。在g-sercom.adb中进行了硬编码,请查找 CRTSCTS。如果您的Intellibox不使用硬件握手,则Write()将被阻止。

I had trouble with Serial_Communication at some point, where it turned out to be a problem with hardware-handshake being enabled in Linux. It's hard-coded in g-sercom.adb, look for "CRTSCTS". If your Intellibox does not use hardware handshake, Write() will block.

我相信我已通过从标志中删除CRTSCTS掩码来解决了此问题。

I believe I solved it by removing the CRTSCTS mask from the flags.

这篇关于Linux上的Ada GNAT.Serial_Communications行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆