feat: ap3825i: parameterize everything

Reflash these with `make run1`, etc.
This commit is contained in:
Martin Kennedy 2025-07-26 18:29:02 -04:00
parent 32c88f6dcb
commit b8df54eed1
3 changed files with 54 additions and 8 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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;