From ff49ad926fe5e79939da5e1dca4ff5175547c32a Mon Sep 17 00:00:00 2001 From: Ellie <64124388+ell1e@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:15:32 +0200 Subject: [PATCH 1/3] Attempt to repair maple_upload for non-dpkg systems --- Bin/uconsole_keyboard_flash/maple_upload | 41 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Bin/uconsole_keyboard_flash/maple_upload b/Bin/uconsole_keyboard_flash/maple_upload index eb1998c..6b038c8 100755 --- a/Bin/uconsole_keyboard_flash/maple_upload +++ b/Bin/uconsole_keyboard_flash/maple_upload @@ -2,19 +2,42 @@ #set -e -architecture="unknow" +have_dpkg="no" +dpkg --version > /dev/null 2>&1 +if [ "x$?" = x0 ]; then + have_dpkg="yes" +fi +dpkg_indicates_arm64="no" +if [ "$have_dpkg" = "yes" ]; then + dpkg_arch_output="`dpkg --print architecture`" + echo "$dpkg_arch_output" | grep -q "arm64" + if [ "x$?" = x0 ]; then + dpkg_indicates_arm64="yes" + fi +fi + +architecture="unknown" case $(uname -m) in x86_64) architecture="amd64" ;; - armv7l) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;; - arm) dpkg --print-architecture | grep -q "arm64" && architecture="aarch64" || architecture="armhf" ;; + armv7l) + if [ "$dpkg_indicates_arm64" = "yes" ]; then + architecture="aarch64" + else + architecture="armhf" + fi;; + arm) + if [ "$dpkg_indicates_arm64" = "yes" ]; then + architecture="aarch64" + else + architecture="armhf" + fi;; aarch64) architecture="aarch64";; riscv64) architecture="riscv64";; esac - -if [ $architecture = "unknow" ]; then - echo "unknow architecture,exiting..." - exit +if [ $architecture = "unknown" ]; then + echo "unknown architecture,exiting..." + exit fi @@ -62,7 +85,9 @@ echo "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R echo -n Waiting for ${dummy_port_fullpath} serial... -dpkg --print-architecture +if [ "$have_dpkg" = "yes" ]; then + dpkg --print-architecture +fi COUNTER=0 while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do sleep 0.2 From 2284ed83bef140dc93af9eb68e897faabba28124 Mon Sep 17 00:00:00 2001 From: Ellie <64124388+ell1e@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:22:15 +0200 Subject: [PATCH 2/3] Output the detected architecture --- Bin/uconsole_keyboard_flash/maple_upload | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Bin/uconsole_keyboard_flash/maple_upload b/Bin/uconsole_keyboard_flash/maple_upload index 6b038c8..a382d53 100755 --- a/Bin/uconsole_keyboard_flash/maple_upload +++ b/Bin/uconsole_keyboard_flash/maple_upload @@ -40,11 +40,13 @@ if [ $architecture = "unknown" ]; then exit fi - if [ $# -lt 4 ]; then echo "Usage: $0 $# " >&2 exit 1 fi + +echo "Detected architecture: $architecture" + dummy_port="$1"; altID="$2"; usbID="$3"; binfile="$4"; dummy_port_fullpath="/dev/$1" if [ $# -eq 5 ]; then dfuse_addr="--dfuse-address $5" From af6fa75652a4246ea11337b2642613c7f7d2927d Mon Sep 17 00:00:00 2001 From: Ellie <64124388+ell1e@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:29:45 +0200 Subject: [PATCH 3/3] Adjust script to 64bit ARM architecture in cases where it's unclear It should probably default to 64bit if dpkg isn't available for a better guess, since that's more commonly what people are going to be using. --- Bin/uconsole_keyboard_flash/maple_upload | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Bin/uconsole_keyboard_flash/maple_upload b/Bin/uconsole_keyboard_flash/maple_upload index a382d53..e77f45d 100755 --- a/Bin/uconsole_keyboard_flash/maple_upload +++ b/Bin/uconsole_keyboard_flash/maple_upload @@ -7,8 +7,9 @@ dpkg --version > /dev/null 2>&1 if [ "x$?" = x0 ]; then have_dpkg="yes" fi -dpkg_indicates_arm64="no" +dpkg_indicates_arm64="yes" if [ "$have_dpkg" = "yes" ]; then + dpkg_indicates_arm64="no" dpkg_arch_output="`dpkg --print architecture`" echo "$dpkg_arch_output" | grep -q "arm64" if [ "x$?" = x0 ]; then