LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-16-2022, 03:19 AM   #1
BruceV
LQ Newbie
 
Registered: Jan 2016
Posts: 22

Rep: Reputation: Disabled
ttyUSB0 access from user code: Debian


I’m working with embedded boards that run Debian. They have an RS232 port (ttyS0) plus a USB port. I use USB for common FTDI serial adaptors (RS232), they appear as /dev/ttyUSB0 as you’d expect, and from picocom they work fine. However, when I access them from my own coded (C) applications they don’t. I know that my code is OK because it works fine with the ttyS0 port, the problem appears to be an access block in the OS between the USB serial and my application.

ttyUSB0 opens fine in my code, there are no error messages. Just no apparent connection to the serial lines.

Is there something I need to do to get ttyUSB0 working with my programs? Thanks for any advice

Last edited by BruceV; 12-16-2022 at 03:22 AM.
 
Old 12-16-2022, 09:59 AM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
What are the differences in attributes of ttyS0 and ttyUSB0?
(baud, parity, start-stop bits, etc.).
Ownership and permissions (and SELinux) also matter.

I can use both since my regular user is a member of the dialout group.
Code:
$ ls -l /dev/ttyS0 /dev/ttyUSB0
crw-rw----. 1 root  dialout   4, 64 Dec 13 11:07 /dev/ttyS0
crw-rw----+ 1 USER  dialout 188,  0 Dec 16 09:50 /dev/ttyUSB0
Does your program run either as root or as a user which is a member of the dialout group? The program may need to execute 'suid'.

Last edited by computersavvy; 12-16-2022 at 10:02 AM.
 
1 members found this post helpful.
Old 12-16-2022, 09:45 PM   #3
BruceV
LQ Newbie
 
Registered: Jan 2016
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thanks a lot, your reply was very useful.
 
  


Reply

Tags
debian 10, serial port, usb



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Issue Device /dev/ttyUSB0 access failed: No such file or directory. treschen Linux - Software 10 07-30-2017 01:36 PM
[SOLVED] how do I access/enable the ttyUSB0 port in the /dev directory of Fedora 17 ? Shweitzer Linux - Newbie 12 12-15-2013 11:16 AM
Is it possible to access an IrDA device as a serial device such as /dev/ttyUSB0? cricketlong Linux - Hardware 1 05-24-2011 03:11 PM
Cannot access /dev/ttyUSB0 for garmin gps rooman Linux - Hardware 4 11-03-2010 02:22 PM
serial to USB, trying to read from /dev/ttyUSB0 in C code newguy21 Programming 1 09-29-2004 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:57 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