Results 1 to 5 of 5

Thread: socat - define device

  1. #1
    Join Date
    Jul 2012
    Location
    EU - Slovenia
    Beans
    75
    Distro
    Ubuntu 14.04 Trusty Tahr

    socat - define device

    Hello...
    I need serial loopback device and I use socat to create it.
    Code:
    socat -d -d pty,raw,echo=0 pty,raw,echo=0
    It works but I wish to be able to set device name.
    Ie when I start I usaly got /dev/pts/23 and /dev/pts/24 but sometime I got /dev/pts/11 and /dev/pts/24.
    Is there a way to set permanent pts ports (/dev/pts/98 and /dev/pts/99 for example?)

    Thanks

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: socat - define device

    From the socat(1) manpage:
    link=<filename>
    Generates a symbolic link that points to the actual pseudo terminal (pty). This might help to solve the problem that ptys are generated with more or less unpredictable names, making it difficult to directly access the socat generated pty automatically. With this option, the user can specify a "fix" point in the file hierarchy that helps him to access the actual pty (example). Beginning with socat version 1.4.3, the symbolic link is removed when the address is closed (but see option unlink-close).

  3. #3
    Join Date
    Jul 2012
    Location
    EU - Slovenia
    Beans
    75
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: socat - define device

    Hello...
    I can't figure out how to create two pts's and linked with link...
    Can someone provide commandline?

    Thanks

  4. #4
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: socat - define device

    Does this work for you?
    Code:
    socat -d -d pty,raw,echo=0,link=/tmp/ttyV0 pty,raw,echo=0,link=/tmp/ttyV1

  5. #5
    Join Date
    Jul 2012
    Location
    EU - Slovenia
    Beans
    75
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: socat - define device

    Quote Originally Posted by schragge View Post
    Does this work for you?
    Code:
    socat -d -d pty,raw,echo=0,link=/tmp/ttyV0 pty,raw,echo=0,link=/tmp/ttyV1
    Yes...
    That's work. Now if I understand correctly socat opens two /dev/pts/ (with number not constant) but linked to constant /tmp/ttyVx...

    Thanks.

Tags for this Thread

Bookmarks

Posting Permissions

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