#!/bin/bash set -x PORT=$1 CONFIGFILE=$2 HOST=$(python3 ../scripts/read_config.py CONFIG_DHCP_HOSTNAME) SSID=$(python3 ../scripts/read_config.py CONFIG_WPA_SSID) PASS=$(python3 ../scripts/read_config.py CONFIG_WPA_KEYPHRASE) cat $PORT & PRINTER_PID=$! # interrupt echo -e -n "\003" >$PORT # Enter RAW Repl echo -e -n "\001" >$PORT echo -e -n "import network\004" >$PORT echo -e -n "wlan = network.WLAN(network.STA_IF)\004" >$PORT echo -e -n "wlan.active(True)\004" >$PORT echo -e -n "wlan.config(dhcp_hostname='$HOST')\004" >$PORT echo -e -n "wlan.connect('$SSID', '$PASS')\004" >$PORT echo -e -n "ap = network.WLAN(network.AP_IF)\004" >$PORT echo -e -n "ap.active(False)\004" >$PORT echo -e -n "\002" >$PORT sleep 3 kill $PRINTER_PID