From ca580667dbfd498568f29873bd9ff6d323b68c75 Mon Sep 17 00:00:00 2001 From: gator96100 Date: Sun, 29 Nov 2020 00:44:58 +0100 Subject: [PATCH 1/2] Fixes for Windows 7 --- pm3 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pm3 b/pm3 index 27e992b11..8cd3c7b92 100755 --- a/pm3 +++ b/pm3 @@ -133,7 +133,8 @@ function get_pm3_list_Windows { # Need to look for this first, the call to Win32_serialport "crashes" then native bt serial port. Don't ask why. #BT direct SERIAL PORTS (COM) if $FINDBTRFCOMM; then - for DEV in $(powershell.exe -command "Get-CimInstance -ClassName Win32_PnPEntity | Where-Object Caption -like 'Standard Serial over Bluetooth link (COM*' | Select Name" 2> /dev/null | awk 'match($0,/COM([0-9]+)/,m){print m[1]}'); do + #Will only work if the english language is installed + for DEV in $(wmic /locale:ms_409 path Win32_PnPEntity Where "Caption LIKE '%Standard Serial over Bluetooth link (COM%'" Get Name 2> /dev/null | awk 'match($0,/COM([0-9]+)/,m){print m[1]}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -143,7 +144,7 @@ function get_pm3_list_Windows { fi # Normal SERIAL PORTS (COM) - for DEV in $(powershell.exe -command "Get-CimInstance -ClassName Win32_serialport | Where-Object PNPDeviceID -like '*VID_9AC4&PID_4B8F*' | Select DeviceID" 2>/dev/null | awk '/^COM/{print $1}'); do + for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_9AC4&PID_4B8F%'" Get DeviceID 2>/dev/null | awk '/^COM/{print $1}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -153,7 +154,7 @@ function get_pm3_list_Windows { #white BT dongle SERIAL PORTS (COM) if $FINDBTDONGLE; then - for DEV in $(powershell.exe -command "Get-CimInstance -ClassName Win32_serialport | Where-Object PNPDeviceID -like '*VID_10C4&PID_EA60*' | Select DeviceID" 2>/dev/null | awk '/^COM/{print $1}'); do + for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_10C4&PID_EA60%'" Get DeviceID 2>/dev/null | awk '/^COM/{print $1}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then From 5b52d95df78b03cd7dcf6abfdefb6392d82b4b24 Mon Sep 17 00:00:00 2001 From: gator96100 Date: Sun, 29 Nov 2020 01:58:16 +0100 Subject: [PATCH 2/2] Fixes for other languages --- pm3 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pm3 b/pm3 index 8cd3c7b92..0d3b9863a 100755 --- a/pm3 +++ b/pm3 @@ -133,8 +133,7 @@ function get_pm3_list_Windows { # Need to look for this first, the call to Win32_serialport "crashes" then native bt serial port. Don't ask why. #BT direct SERIAL PORTS (COM) if $FINDBTRFCOMM; then - #Will only work if the english language is installed - for DEV in $(wmic /locale:ms_409 path Win32_PnPEntity Where "Caption LIKE '%Standard Serial over Bluetooth link (COM%'" Get Name 2> /dev/null | awk 'match($0,/COM([0-9]+)/,m){print m[1]}'); do + for DEV in $(wmic /locale:ms_409 path Win32_PnPEntity Where "Caption LIKE '%Bluetooth%(COM%'" Get Name 2> /dev/null | awk -b 'match($0,/(COM[0-9]+)/,m){print m[1]}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -144,7 +143,7 @@ function get_pm3_list_Windows { fi # Normal SERIAL PORTS (COM) - for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_9AC4&PID_4B8F%'" Get DeviceID 2>/dev/null | awk '/^COM/{print $1}'); do + for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_9AC4&PID_4B8F%'" Get DeviceID 2>/dev/null | awk -b '/^COM/{print $1}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -154,7 +153,7 @@ function get_pm3_list_Windows { #white BT dongle SERIAL PORTS (COM) if $FINDBTDONGLE; then - for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_10C4&PID_EA60%'" Get DeviceID 2>/dev/null | awk '/^COM/{print $1}'); do + for DEV in $(wmic /locale:ms_409 path Win32_SerialPort Where "PNPDeviceID LIKE '%VID_10C4&PID_EA60%'" Get DeviceID 2>/dev/null | awk -b '/^COM/{print $1}'); do DEV=${DEV/ */} PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then