Solved

check if a com port exists by C code

Posted on 2001-06-18
2
730 Views
Last Modified: 2011-10-03
How can we check if a com port exists by C code?
0
Comment
Question by:mathematics
2 Comments
 
LVL 5

Expert Comment

by:garboua
ID: 6205981
I don't know how to check using c, but they should be under /dev listed as ttys0-ttys3
0
 

Accepted Solution

by:
ragaMuffin earned 20 total points
ID: 6208013
com ports are character devices.  As a character device is initialized, its device driver registers itself with the linux kernel by adding an entry into the chrdevs vector of device_struct data structure.  You can call a device and tread it exaclty like a file.  operation on a character device include iseek,read,write,readdir,select,ioctl .... etc.
you can use the open function with O_RDONLY, O_WRONLY, or O_RDWR
do a man on open to get details and header files needed.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question