From f53c0a3fd9230b65b00df8f50879ad012aff9146 Mon Sep 17 00:00:00 2001 From: Wayfarer <32709746+WangYangfan@users.noreply.github.com> Date: Fri, 10 May 2024 20:56:54 +0800 Subject: [PATCH] Update hidpi.sh --- hidpi.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hidpi.sh b/hidpi.sh index ff76067..fe6d949 100755 --- a/hidpi.sh +++ b/hidpi.sh @@ -222,10 +222,15 @@ function get_vidpid_applesilicon() { local prodNameQuery="$prodAttrsQuery$prodname$value$get" # Get VIDs, PIDs, Prodnames - local vends=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$vendIDQuery")) - local prods=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$prodIDQuery")) + # local vends=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$vendIDQuery")) + # local prods=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$prodIDQuery")) + + local vends=($(ioreg -l | grep "DisplayAttributes" | tail -n +2 | sed -n 's/.*"LegacyManufacturerID"=\([0-9]*\).*/\1/p')) + local prods=($(ioreg -l | grep "DisplayAttributes" | tail -n +2 | sed -n 's/.*"ProductID"=\([0-9]*\).*/\1/p')) + set -o noglob - IFS=$'\n' prodnames=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$prodNameQuery")) + # IFS=$'\n' prodnames=($(ioreg -arw0 -d1 -c $appleDisplClass | xpath -q -n -e "$prodNameQuery")) + IFS=$'\n' prodnames=($(ioreg -l | grep "DisplayAttributes" | tail -n +2 | sed -n 's/.*"ProductName"="\([^"]*\)".*/\1/p')) set +o noglob if [[ "${#prods[@]}" -ge 2 ]]; then