Serial Port Debugging on Ubuntu

7,145

Solution 1

I was able to retrieve all the settings by running an strace on the process id. The following command helped:

    :~/dos$ sudo strace -p <pid> -t -v -o dump.txt

    pid- process ID of my process
    t - adds a timestamp to the system call trace
    v - expands the termios structure which basically contains the serial port settings, without this flag the structure will be truncated
    o - output the trace to a dump file specified

This not only gave me all the setting related information,but also gave me the protocol specifics such as what IOCTLs (TIOCM_RTS, TIOCM_DSR etc) Thanks to everyone who helped me out here!

Solution 2

I just wrote a simple tool which can help you out. Checkout here. Note: you should use -v option

Share:
7,145

Related videos on Youtube

Nachiketh
Author by

Nachiketh

Updated on September 18, 2022

Comments

  • Nachiketh
    Nachiketh over 1 year

    I have a written a C++ program on Ubuntu 14.04 LTS which communicates with a USB2Serial device /dev/ttyUSB0 . I want to know if the connection parameters are set correctly on this file handle, what would be the best way to figure this on Ubuntu? Windows provides a few GUI software which shows all the information in detail, however I'm yet to find something similar in Ubuntu.
    The ones I have tried so far(sersniff, grabserial) shows the data but not the connection and other control parameters such as setting CTS, DTR, RI etc. I basically want to see what are the termios settings that are getting set on the serial port handle at run time
    TIA!!

  • Nachiketh
    Nachiketh over 8 years
    as far as I know, minicom can be used to connect to a modem and send text commands to the same. In my case I need something like a wireshark inorder to debug my application to see if it is setting the correct communication properties and sending the right control signals. I have gone through the minicom configurations and did not find a sniff mode in it, please correct me if I'm wrong.
  • Nachiketh
    Nachiketh over 8 years
    as far as I know, minicom can be used to connect to a modem and send text commands to the same. In my case I need something like a wireshark inorder to debug my application to see if it is setting the correct communication properties and sending the right control signals. I have gone through the minicom configurations and did not find a sniff mode in it, please correct me if I'm wrong
  • pzkpfw
    pzkpfw over 8 years
    You might find some help here: stackoverflow.com/questions/15469511/…