在linux中与CashCode票据接收器通信 [英] Communicating with CashCode bill acceptor in linux

查看:44
本文介绍了在linux中与CashCode票据接收器通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Linux 上通过我的软件实现了 CCNET 协议来与 CashCode 账单接收器进行通信.最初我花了很多时间试图弄清楚为什么设备不响应​​我发送的命令.使用反复试验的方法,我找到了为串行端口设置以下选项的解决方案:

I've implemented CCNET protocol to communicate with CashCode bill acceptor from my software on Linux. Initially I spent lots of time trying to figure out why the device does not respond to the commands I'm sending. Using trial-and-error method I found the solution to set the following options for the serial port:

stty -F /dev/ttyS0 9600 cs8 -cstopb -parenb clocal -crtscts -ixon -ixoff ignpar -icrnl -opost -isig -icanon -iexten -echo

它正在开发机器和另外两台测试机器上工作(它们都有不同的主板).但是,在第三台测试机(还有另一个主板)上,该设备似乎没有再次响应.但是,它可以在同一台机器上使用不同软件在 Windows 上运行.

It was working on the development machine and on two another testing machines (all of them had different motherboards). However, on the third testing machine (having yet another mobo) it seems that the device is not responding again. It is, however, working on Windows with different software on the same machine.

在不响应"下,我的意思是在发送命令后的 10 秒超时期间无法从串行端口读取任何内容.整个代码经过测试并在另一块主板上运行.如 dmesg 中所述,内核正确检测到端口本身:

Under "does not respond" I mean that nothing can be read from the serial port during 10-second timeout after sending the command. The whole code is tested and working on another motherboards. The port itself is detected by the kernel correctly as stated in dmesg:

[    1.099382] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    1.127531] 00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

dmesg 中没有关于这个串口的警告.有关如何调试此问题的任何想法?

There are no warnings in dmesg regarding this serial port. Any ideas on how to debug this issue?

stty -F/dev/ttyS0"的完整输出:

The full output of "stty -F /dev/ttyS0":

speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

推荐答案

问题解决了.这种票据承兑器模型在 19200 波特下工作.将端口切换到 19200 即可解决问题.

Problem is solved. This model of bill acceptor is working at 19200 baud. Switching the port to 19200 solves the problem.

这篇关于在linux中与CashCode票据接收器通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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