Page 1 of 1

Unable to Communicate with ttyACM devices in CentOS8

Posted: 2020/06/26 06:49:57
by arunodaya.s
We are trying to communicate to a ttyACM(x) device using gtkterm & are not able to communicate to it while using CentOS8.

Version of gtkterm :
arunodaya.s@localhost ~]$ gtkterm --help
GTKTerm version 1.0
(c) Julien Schmitt

Centos 8 Kernel version :
[arunodaya.s@localhost ~]$ uname -a
Linux localhost.localdomain 4.18.0-147.8.1.el8_1.x86_64 #1 SMP Thu Apr 9 13:49:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[arunodaya.s@localhost ~]$

However we are able to connect to a loop back device (ttyUSB(x)) & are able to communicate.

Also we tried the same thing in a Fedora 31 machine & found the same problem.

However its working fine in Ubuntu 18 LTS.

Here is the strace output of gtkterm log:
openat(AT_FDCWD, "/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 10
flock(10, LOCK_EX|LOCK_NB) = 0
ioctl(10, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(10, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(10, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(10, TCFLSH, TCOFLUSH) = 0
ioctl(10, TCFLSH, TCIFLUSH) = 0
fstat(10, {st_mode=S_IFCHR|0660, st_rdev=makedev(166, 0), ...}) = 0
fcntl(10, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
fstat(10, {st_mode=S_IFCHR|0660, st_rdev=makedev(166, 0), ...}) = 0
fcntl(10, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 3, 0) = 1 ([{fd=4, revents=POLLIN}])
read(4, "\5\0\0\0\0\0\0\0", 16) = 8
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 3, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}]).
Any suggestions to this issue would be helpful.

Re: Unable to Communicate with ttyACM devices in CentOS8

Posted: 2020/06/26 08:18:42
by TrevorH
Are the permissions on the device correct?

Re: Unable to Communicate with ttyACM devices in CentOS8

Posted: 2020/06/26 09:05:08
by arunodaya.s
Yes. The device permission have not been tweaked. The device gets registered as ttyACM0 when connected to the system with the default permissions. The normal user is already in dialout, group so should not be a problem. For the sake of testing tried as root as well, but no change.

Had a doubt on selinux, but didn't work even in permissive mode. No log entries in audit.log

Re: Unable to Communicate with ttyACM devices in CentOS8

Posted: 2020/07/01 06:51:32
by arunodaya.s
The root cause of the issue is with auto initialization of Modem(ttyACM) and the way it is handled. We added a sniffer in between the CentOS and the ttyACm device & found that, before we send any data, the CentOS itself sends "AT" command for modem initialization. This was rendering the device to go into undefined mode. The device in question is not a modem but is enumerating as one (Virtual COM Port).

We have disabled the ModemManager service and now as it looks like it is working normally. Need to find a more graceful way of handling this.