From e8eee7b28cb32c6d5b87d6a801a4341265bd1949 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Sat, 19 Oct 2024 00:48:03 -0600 Subject: [PATCH] add setup files and lorocat.py testing script --- lorocat.py | 16 ++++++++++++++++ setup-loro_rpi3.sh | 14 ++++++++++++++ setup-lora_pi4.c => setup-loro_rpi4.sh | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 lorocat.py create mode 100755 setup-loro_rpi3.sh rename setup-lora_pi4.c => setup-loro_rpi4.sh (73%) diff --git a/lorocat.py b/lorocat.py new file mode 100755 index 0000000..2b12a2a --- /dev/null +++ b/lorocat.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import socket, sys, time + +sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) +sock.connect(('fdfd:cafe::1', 6969)) + +while True: + data = sys.stdin.buffer.read(64) + if not data: + break + + sock.sendall(data) + time.sleep(0.869) + +sock.close() diff --git a/setup-loro_rpi3.sh b/setup-loro_rpi3.sh new file mode 100755 index 0000000..31097c7 --- /dev/null +++ b/setup-loro_rpi3.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +modprobe regmap_spi +modprobe mac802154 +insmod /home/loro/LoRo/LoRo/loro.ko tx_poll_div=1 +sleep 1 +ip link set down wpan0 +iwpan dev wpan0 set pan_id 0xbeef +ip link add link wpan0 name lowpan0 type lowpan +ip link set up wpan0 +ip link set up lowpan0 +ip addr add fdfd:cafe::1/64 dev lowpan0 diff --git a/setup-lora_pi4.c b/setup-loro_rpi4.sh similarity index 73% rename from setup-lora_pi4.c rename to setup-loro_rpi4.sh index 555797a..646ef53 100755 --- a/setup-lora_pi4.c +++ b/setup-loro_rpi4.sh @@ -4,10 +4,11 @@ set -e modprobe regmap_spi modprobe mac802154 -insmod ~/LoRo/LoRo/loro.ko +insmod ~/LoRo/LoRo/loro.ko tx_poll_div=1 sleep 0.5 ip link set down wpan0 iwpan dev wpan0 set pan_id 0xbeef ip link add link wpan0 name lowpan0 type lowpan ip link set up wpan0 ip link set up lowpan0 +ip addr add fdfd:cafe::2/64 dev lowpan0