diff --git a/Makefile b/Makefile index 62e8da5..9fa948d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,41 @@ .PHONY: run -run: ./ap3825i.expect - env OUTPUT_LOG_FILE=$(shell date +%Y-%m-%d_%H-%M-%S).date.log ./ap3825i.expect + +run0: ./ap3825i.expect + env \ + LAN_PORT=lan14 \ + SERIAL_PORT=/dev/ttyUSB0 \ + MACHINE_ADDRESS=192.168.0.2 \ + INITRAMFS_FILENAME=openwrt-mpc85xx-p1020-extreme-networks_ws-ap3825i-initramfs-kernel.bin \ + OUTPUT_LOG_FILE=$(shell date +%Y-%m-%d_%H-%M-%S).date.log \ + ./ap3825i.expect + +run1: ./ap3825i.expect + env \ + LAN_PORT=lan16 \ + SERIAL_PORT=/dev/ttyUSB1 \ + MACHINE_ADDRESS=192.168.0.3 \ + INITRAMFS_FILENAME=openwrt-mpc85xx-p1020-extreme-networks_ws-ap3825i-initramfs-kernel.bin \ + OUTPUT_LOG_FILE=$(shell date +%Y-%m-%d_%H-%M-%S).date.log \ + ./ap3825i.expect + +run2: ./ap3825i.expect + env \ + LAN_PORT=lan18 \ + SERIAL_PORT=/dev/ttyUSB2 \ + MACHINE_ADDRESS=192.168.0.4 \ + INITRAMFS_FILENAME=openwrt-mpc85xx-p1020-extreme-networks_ws-ap3825i-initramfs-kernel.bin \ + OUTPUT_LOG_FILE=$(shell date +%Y-%m-%d_%H-%M-%S).date.log \ + ./ap3825i.expect + +run3: ./ap3825i.expect + env \ + LAN_PORT=lan20 \ + SERIAL_PORT=/dev/ttyUSB3 \ + MACHINE_ADDRESS=192.168.0.5 \ + INITRAMFS_FILENAME=openwrt-mpc85xx-p1020-extreme-networks_ws-ap3825i-initramfs-kernel.bin \ + OUTPUT_LOG_FILE=$(shell date +%Y-%m-%d_%H-%M-%S).date.log \ + ./ap3825i.expect + +.PHONY: follow +follow: + find . -type f -name '*.log' | xargs ls -tr | tail -1 | xargs tail -f diff --git a/ap3825i.expect b/ap3825i.expect index 13da918..e30c3b0 100755 --- a/ap3825i.expect +++ b/ap3825i.expect @@ -38,9 +38,9 @@ proc reliable_send {str} { } } -spawn picocom -b 115200 /dev/ttyUSB1 --logfile $env(OUTPUT_LOG_FILE) +spawn picocom -b 115200 $env(SERIAL_PORT) --logfile $env(OUTPUT_LOG_FILE) set term_id $spawn_id -spawn ./toggle_jg928a_port.sh +spawn ./toggle_jg928a_port.sh $env(LAN_PORT) set spawn_id $term_id expect "DRAM" @@ -54,8 +54,16 @@ send "new2day\n" expect { "Boot (PRI)-> " { - send -s {setenv ramboot_openwrt "setenv ipaddr 192.168.0.2; setenv serverip 192.168.0.1; tftpboot 0x2000000 openwrt-mpc85xx-p1020-extreme-networks_ws-ap3825i-initramfs-kernel.bin; interrupts off; bootm 0x2000000;"; setenv boot_openwrt "bootm 0xEC000000;"; setenv bootcmd "run boot_openwrt"; saveenv; -} + send -s {setenv ramboot_openwrt "setenv ipaddr } + # " + send -s "$env(MACHINE_ADDRESS)" + send -s {; setenv serverip 192.168.0.1; tftpboot 0x2000000 } + send -s "$env(INITRAMFS_FILENAME)" + send -s {; interrupts off; bootm 0x2000000;"} + # " + send -s "\n" + send -s {setenv boot_openwrt "bootm 0xEC000000;"; setenv bootcmd "run boot_openwrt"; saveenv;} + send -s "\n" } } expect { diff --git a/toggle_jg928a_port.sh b/toggle_jg928a_port.sh index 52c6a9c..f17a5f3 100755 --- a/toggle_jg928a_port.sh +++ b/toggle_jg928a_port.sh @@ -6,10 +6,10 @@ function s { echo before: | tr '\n' '\t' s ubus call poe info -s ubus call poe manage '{"port": "lan16", "enable": false}' +s ubus call poe manage '{"port": "'$1'", "enable": false}' sleep 2; echo after shutoff: | tr '\n' '\t'; s ubus call poe info; -s ubus call poe manage '{"port": "lan16", "enable": true}' +s ubus call poe manage '{"port": "'$1'", "enable": true}' sleep 2;