PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, April 21, 2022

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

 April 21, 2022     connection, dart, linux, simulator, virtual-serial-port     No comments   

Issue

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

  • Download gpsfeed+ from https://gpsfeed.sourceforge.io/
  • Make executable the file downloaded:
$ chomod +x gpsfeed+_amd64
  • Install socat package:
$ sudo pacman -S socat
  • Create a pair of virtual serial ports (VSPs) with socat:
$ socat -d -d pty,raw,echo=0 pty,raw,echo=0
  • It displays virtual ports created, in this case: /dev/pts/4 and /dev/pts/5. One port will be transmitter and the another one will be the receiver.
  • Open gpsfeed+ application:
$ ./gpsfeed+_amd64\
  • In Configuration for gpsfeed+ to do:
  1. Connection >> check: Serial, and uncheck: TCP, UDP, Http
  2. Serial/IP >> Port: /dev/pts/4 (transmitter), and Speed: 9600
  • Run simulator (button with a concentric circle as icon)
  • Read data from /dev/pts/5 (receiver)

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.



Answered By - Ουιλιαμ Αρκευα
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing