blob: 8621bf02bcc9b46a55819dcdeb2f841168372572 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/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
|