Find the answer to your Linux question:
Results 1 to 3 of 3
The question is: how can I make the data written to the COM port to be available back for read immediately? In other words I need software loopback on com ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Aug 2005
    Posts
    214

    Need software loopback on com port.


    The question is: how can I make the data written to the COM port to be available back for read immediately? In other words I need software loopback on com port.

    Some briefing: I wrote an application that reads data sent by some industrial machine, parses it, and writes results somewhere. The problem is that it's not so easy to go to the customer place and get connected to that device in order to make application tests. So I need to simulate data being written to the port. That's why I bought a 9-pin COM socket, and connected the appropriate pins to each other to get COM port loopback device. Then I send data to the port
    Code:
    echo "data from deviceX" > /dev/ttyS0
    and that line can be read by application. Everything works fine, but... I want to achieve the same functionality without that loopback device, cause first: my com port is always in use, but I need it for other purposes and second: I'm afraid to burn up my only com port on laptop with such experiments one day. Is this can be done with pipes and device files, if yes then how?

  2. #2
    Just Joined!
    Join Date
    Sep 2005
    Posts
    5

    mkfifo

    You may look into the mkfifo command with which you can create named pipes as follows:
    Code:
    mkfifo dummy_ttyS0
    Then you can with some program write data to it like:
    Code:
    echo "data from deviceX" > dummy_ttyS0
    And read it (simultaneously) with an other program, e.g.:
    Code:
    cat dummy_ttyS0

  3. #3
    Linux Newbie
    Join Date
    Aug 2005
    Posts
    214
    Great, thanks!

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •