From 4ab5d9febc45637aec15584a32746ad3a4197de7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 12 Nov 2022 01:52:44 +0100 Subject: [PATCH] fixing serial port detection with WSL2 + usbipd , thanks to jrozner for verifying --- CHANGELOG.md | 1 + pm3 | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b44c517e..5ebafa820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fixed `pm3` shell script now automatically detects WSL2 with USBIPD serial ports (@iceman1001) - Fixed `trace list -c` - annotation of CRC bytes now is colored or squared if no ansi colors is supported (@iceman1001) - Fixed `trace list -t mf` - now also finds UID if anticollision is partial captured, to be used for mfkey (@iceman1001) - Added `hf mf gload, ggetblk, gsetblk` for Gen4 GTU in mifare classic mode (@DidierA) diff --git a/pm3 b/pm3 index e4469cd29..c0b0869b0 100755 --- a/pm3 +++ b/pm3 @@ -59,18 +59,20 @@ function get_pm3_list_Linux { fi for DEV in $(find /dev/ttyACM* 2>/dev/null); do if command -v udevadm >/dev/null; then + # WSL1 detection if udevadm info -q property -n "$DEV" | grep -q "ID_VENDOR=proxmark.org"; then PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then return fi fi - else - if grep -q "proxmark.org" "/sys/class/tty/${DEV#/dev/}/../../../manufacturer" 2>/dev/null; then - PM3LIST+=("$DEV") - if [ ${#PM3LIST[*]} -ge "$N" ]; then - return - fi + fi + # WSL2 with usbipd detection - doesn't report same things as WSL1 + + if grep -q "proxmark.org" "/sys/class/tty/${DEV#/dev/}/../../../manufacturer" 2>/dev/null; then + PM3LIST+=("$DEV") + if [ ${#PM3LIST[*]} -ge "$N" ]; then + return fi fi done