Java RXTXcomm lib连接到/ dev / ttyACM0 [英] Java RXTXcomm lib to connect to /dev/ttyACM0

查看:358
本文介绍了Java RXTXcomm lib连接到/ dev / ttyACM0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用RXXTX java lib连接到串行端口。我使用这个lib可以毫无问题地连接到/ dev / ttyUSB0(1、2、3等)。

I'm using RXXTX java lib to connect to serial ports. I'm using this lib with no problems connecting to /dev/ttyUSB0 (1,2,3,etc).

但是当我想连接到/ dev / ttyACM0端口未找到。

But when I want to connect to /dev/ttyACM0 the port its not found.

CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("/dev/ttyACM0");

抛出异常:


gnu.io.NoSuchPortException
at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218)

gnu.io.NoSuchPortException at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218)

我已经列出了所有端口,但没有成功。

I already listed all the ports but no success.

推荐答案

处理和USB端口/ dev / ttyACM0,/ dev / ttyACM1,....
http:/ /pblog.ebaker.me.uk/2011/09/processing-usb-ports-devttyacm0.html

Processing and USB ports /dev/ttyACM0, /dev/ttyACM1, .... http://pblog.ebaker.me.uk/2011/09/processing-usb-ports-devttyacm0.html


处理不就像读取Linux USB设备(例如/ dev / ttyACM0或
/ dev / ttyACM1)一样。

Processing doesn't like reading Linux USB devices like /dev/ttyACM0 or /dev/ttyACM1.

该解决方案很简单,只需将此类设备符号链接即可。 。

The solution is easy, just symlink the devices like this...

ln -s / dev / ttyACM [x] / dev / ttyS8 [x]

ln -s /dev/ttyACM[x] /dev/ttyS8[x]

您可以在ttyS后面放置任何数字,尽管可能会定义
ttyS0和其他低数字,但八进制数字es保证
(几乎)可以正常工作。

You can put any number after the ttyS, although it is possible that ttyS0 and other low numbers are defined, numbers in the eighties are (almost) guaranteed to work.

这篇关于Java RXTXcomm lib连接到/ dev / ttyACM0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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