#!/bin/sh
# run2_console.sh -- DF-2343 trigger (2): USB serial console with
# hw.usb.ucom.cons_baud=0.  Boot the baseline UMCSH kernel with
# hw.usb.ucom.cons_unit=0 and hw.usb.ucom.cons_baud=0 in loader.conf,
# then attach: usb_serial.c:523-533 calls ucom_param() with
# c_ospeed = ucom_cons_baud = 0 during ucom_attach_tty().
set -e
cd /root/umcs
echo "=== DF-2343 trigger (2): console attach with cons_baud=0 ==="
uname -a
sysctl hw.usb.ucom.cons_unit hw.usb.ucom.cons_baud
grep -E 'ucom\.cons' /boot/loader.conf || true
echo "ABOUT TO: ./umcshctl 4 0x01 0  (attach; expect Fatal trap 0 during ucom_attach)"
./umcshctl 4 0x01 0
echo "SURVIVED console attach (unexpected on stock kernel)"
