LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 06-25-2020, 05:55 AM   #1
arunodaya.s
LQ Newbie
 
Registered: Jun 2020
Posts: 5

Rep: Reputation: Disabled
Unable to Communicate with ttyACM devices in CentOS8


We are trying to establish communication between a ttyACMx UART device & a PC which runs CentOS8.

We are using gtkterm to send data to the UART device.
The version of gtkterm is :
[root@localhost arunodaya.s]# gtkterm --help
GTKTerm version 1.0
(c) Julien Schmitt

Kernal version is :
[root@localhost arunodaya.s]# 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

If we connect a loop back device (ttyUSBx), we are able to communicate using gtkterm.

We tried in a machine with fedora 31 & found the same problem.

The same device (UART) is communicating fine in an ubuntu 18 (LTS version).

O/P log of strace when using gtkterm

0 openat(AT_FDCWD, "/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 10
1 flock(10, LOCK_EX|LOCK_NB) = 0
2 ioctl(10, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
3 ioctl(10, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
4 ioctl(10, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
5 ioctl(10, TCFLSH, TCOFLUSH) = 0
6 ioctl(10, TCFLSH, TCIFLUSH) = 0
7 fstat(10, {st_mode=S_IFCHR|0660, st_rdev=makedev(166, 0), ...}) = 0
8 fcntl(10, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
9 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
10 fstat(10, {st_mode=S_IFCHR|0660, st_rdev=makedev(166, 0), ...}) = 0
11 fcntl(10, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
12 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
13 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
14 poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 3, 0) = 1 ([{fd=4, revents=POLLIN}])
15 read(4, "\5\0\0\0\0\0\0\0", 16) = 8
16 poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 3, 0) = 0 (Timeout)
17 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])

Kindly suggest us a solution.
 
Old 06-28-2020, 08:11 PM   #2
tinfoil3d
Member
 
Registered: Apr 2020
Location: Japan/RJCC
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268

Rep: Reputation: 75
Just to verify, did you also try other ways to communicate, like, other software like minicom, screen? did you also compare the relevant strace output for both working(ubuntu) and not working systems?
 
Old 06-30-2020, 03:26 AM   #3
arunodaya.s
LQ Newbie
 
Registered: Jun 2020
Posts: 5

Original Poster
Rep: Reputation: Disabled
We tried with minicom, we had the same issue. We compared the strace output, the difference is this extra line which has timeout for all file descriptors. We are not sure whether this will lead to this behavior.

"16 poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 3, 0) = 0 (Timeout)"
 
Old 06-30-2020, 09:47 AM   #4
tinfoil3d
Member
 
Registered: Apr 2020
Location: Japan/RJCC
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268

Rep: Reputation: 75
Is it all on the SAME machine with SAME device?
 
Old 07-01-2020, 01:53 AM   #5
arunodaya.s
LQ Newbie
 
Registered: Jun 2020
Posts: 5

Original Poster
Rep: Reputation: Disabled
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 OS and the device & found that, before we send any data, the OS itself sends "AT" command for modem initialization. This was rendering the ttyACM 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.
 
Old 07-01-2020, 01:54 AM   #6
arunodaya.s
LQ Newbie
 
Registered: Jun 2020
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tinfoil3d View Post
Is it all on the SAME machine with SAME device?
No, we checked with different configuration (same device but different machine)
 
Old 07-01-2020, 02:51 AM   #7
tinfoil3d
Member
 
Registered: Apr 2020
Location: Japan/RJCC
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268

Rep: Reputation: 75
That's very informative, thanks.
Maybe there's a way to disable handling of modems in there by default instead of shutting the whole thing down. There must be.
 
Old 06-21-2021, 08:15 AM   #8
arunodaya.s
LQ Newbie
 
Registered: Jun 2020
Posts: 5

Original Poster
Rep: Reputation: Disabled
If we Change the ModemManager.service to start in strict instead of default, this issue can be overcome as well.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative to /etc/hosts/allow on CentOS8 elliot01 Linux - Security 13 01-11-2021 10:12 AM
[SOLVED] Data loss over ttyACM shivp33 Linux - Kernel 3 07-11-2018 07:58 AM
How to Communicate Virtual Serial Port on Host(windows) to Communicate with Virtual Serial Port on Guest System(Linux) aquamarine Linux - Newbie 2 09-16-2016 02:48 PM
[SOLVED] Double ttyACM node device from Sony Ericsson C510 jcampos79 Linux - Newbie 7 05-06-2015 05:36 PM
block on write call to ttyACM device gkogut Programming 1 11-04-2010 09:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration