From 37cc00dfc0be88741f4e43f94ffe41cf9799ade0 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Fri, 6 Jun 2025 22:10:59 -0500 Subject: [PATCH] updates --- scripts/navka-core.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/navka-core.sh b/scripts/navka-core.sh index 3418ff1..180e589 100644 --- a/scripts/navka-core.sh +++ b/scripts/navka-core.sh @@ -19,12 +19,11 @@ G=/sys/kernel/config/usb_gadget/navka # 4) Tear down any previous half-built gadget if [[ -d $G ]]; then - echo "" >"$G/UDC" 2>/dev/null || true + echo '' >"$G/UDC" 2>/dev/null || true + sleep 0.2 find "$G/configs" -type l -delete 2>/dev/null || true - for fn in "$G"/functions/*; do - [[ -d $fn ]] && rmdir "$fn" || true - done - rmdir "$G" 2>/dev/null || true + rm -rf "$G/functions"/* 2>/dev/null || true + rmdir "$G" || true fi # 5) Create gadget (boot-keyboard + UAC2 mic/spkr, 500 mA max) @@ -43,11 +42,11 @@ mkdir -p "$G/functions/hid.usb0" echo 1 >"$G/functions/hid.usb0/protocol" echo 1 >"$G/functions/hid.usb0/subclass" echo 8 >"$G/functions/hid.usb0/report_length" -echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25'\ -'\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x01\x95\x05\x75\x01'\ -'\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x01\x95\x06\x75'\ -'\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0' \ - >"$G/functions/hid.usb0/report_desc" +cat >"$G/functions/hid.usb0/report_desc" <<'EOF' +05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 75 01 95 08 81 02 +95 01 75 08 81 01 95 05 75 01 05 08 19 01 29 05 91 02 95 01 75 03 +91 01 95 06 75 08 15 00 25 65 05 07 19 00 29 65 81 00 c0 +EOF # # -- UAC2 Audio # mkdir -p $G/functions/uac2.usb0 @@ -57,8 +56,8 @@ echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25'\ # -- Config mkdir -p $G/configs/c.1/strings/0x409 -echo "Config 1" > $G/configs/c.1/strings/0x409/configuration -echo 500 > $G/configs/c.1/MaxPower +echo 'Kbd only' >"$G/configs/c.1/strings/0x409/configuration" +echo 250 > $G/configs/c.1/MaxPower # -- Bindings ln -s $G/functions/hid.usb0 $G/configs/c.1/