Compare commits

...

2 Commits

Author SHA1 Message Date
Paul 187390e375 removed SerialEmulator.py 2024-01-08 15:27:55 +01:00
Paul a7e38aedb7 populated readme 2024-01-08 15:27:32 +01:00
2 changed files with 12 additions and 35 deletions

View File

@ -0,0 +1,12 @@
# Lora 2 Serial
## Mapping rfm9x SPI Device to a Serial File Interface for usage with AX.25 Kiss
creates /tmp/rfmtty and /tmp/rfmtty_client
Attach using kissattach /tmp/rfmtty_client ax0 IP_ADDRESS
with configured axports
https://github.com/dmahony/LoRa-AX25-IP-Network/wiki/Installation-Instructions
http://packet-radio.info/index.php?id=packet-radio-unter-linux-mit-linpac

View File

@ -1,35 +0,0 @@
import os, subprocess, serial, time
# this script lets you emulate a serial device
# the client program should use the serial port file specifed by client_port
# if the port is a location that the user can't access (ex: /dev/ttyUSB0 often),
# sudo is required
class SerialEmulator(object):
def __init__(self, device_port='./ttydevice', client_port='./ttyclient'):
self.device_port = device_port
self.client_port = client_port
cmd=['/usr/bin/socat','-d','-d','PTY,link=%s,raw,echo=0' %
self.device_port, 'PTY,link=%s,raw,echo=0' % self.client_port]
self.proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(1)
self.serial = serial.Serial(self.device_port, 9600, rtscts=True, dsrdtr=True)
self.err = ''
self.out = ''
def write(self, out):
self.serial.write(out)
def read(self):
line = ''
while self.serial.inWaiting() > 0:
line += self.serial.read(1)
return line
def __del__(self):
self.stop()
def stop(self):
self.proc.kill()
self.out, self.err = self.proc.communicate()