linuxdartconnectionsimulatorvirtual-serial-port

How to connect two virtual serial ports to read data from GPSFeed+?


Recently I've downloaded gpsfeed+ file, I set executable attribute and run it with (OS: Manjaro):

$ ./gpsfeed+_amd64\

I'm trying to list all ports connected through a Dart program (code here by using package dart_serial_port), but it lists nothing. I'm assuming it is because of virtual serial ports are not connected, but I don't know how to get this. There is a program like com0com but it works on Windows only.

Any recommendation? Are there other simulators like gpsfeed?

PS: gpsfeed+ is configured to work by using COM3 (protocol RS-232).


Solution

  • Steps

    $ chomod +x gpsfeed+_amd64
    
    $ sudo pacman -S socat
    
    $ socat -d -d pty,raw,echo=0 pty,raw,echo=0
    
    $ ./gpsfeed+_amd64\
    
    1. Connection >> check: Serial, and uncheck: TCP, UDP, Http
    2. Serial/IP >> Port: /dev/pts/4 (transmitter), and Speed: 9600

    Python code (install pyserial package):

    import serial
    
    ser = serial.Serial('/dev/pts/5', 9600)
    iter = 5
    
    while iter > 0:
      print(ser.readline().decode("utf-8"))
      iter -= 1
    

    The very few existing packages for Dart (like dart_serial_port) do not work with virtual ports.