From 2fea7597a3ab9785963f83b873d9a84ed5e13263 Mon Sep 17 00:00:00 2001 From: florrant Sazerac Date: Thu, 25 Apr 2024 14:40:47 +0200 Subject: [PATCH] Add support for stlink-v3pwr --- config/udev/rules.d/49-stlinkv3.rules | 7 ++++++- src/stlink-lib/usb.c | 3 ++- src/stlink-lib/usb.h | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config/udev/rules.d/49-stlinkv3.rules b/config/udev/rules.d/49-stlinkv3.rules index 98c33ed..71242d1 100644 --- a/config/udev/rules.d/49-stlinkv3.rules +++ b/config/udev/rules.d/49-stlinkv3.rules @@ -27,7 +27,12 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374e", \ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374f", \ MODE:="0666", \ SYMLINK+="stlinkv3_%n" - + +# STLink V3PWR +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3757", \ + MODE:="0666", \ + SYMLINK+="stlinkv3_%n" + # If you share your linux system with other users, or just don't like the # idea of write permission for everybody, you can replace MODE:="0666" with # OWNER:="yourusername" to create the device owned by you, or with diff --git a/src/stlink-lib/usb.c b/src/stlink-lib/usb.c index 83e2652..1f8bf91 100644 --- a/src/stlink-lib/usb.c +++ b/src/stlink-lib/usb.c @@ -1256,7 +1256,8 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, enum connect_type connect, desc.idProduct == STLINK_USB_PID_STLINK_V3E_PID || desc.idProduct == STLINK_USB_PID_STLINK_V3S_PID || desc.idProduct == STLINK_USB_PID_STLINK_V3_2VCP_PID || - desc.idProduct == STLINK_USB_PID_STLINK_V3_NO_MSD_PID) { + desc.idProduct == STLINK_USB_PID_STLINK_V3_NO_MSD_PID || + desc.idProduct == STLINK_USB_PID_STLINK_V3P) { slu->ep_req = 1 /* ep req */ | LIBUSB_ENDPOINT_OUT; slu->ep_trace = 2 | LIBUSB_ENDPOINT_IN; } else { diff --git a/src/stlink-lib/usb.h b/src/stlink-lib/usb.h index 2ec7490..7831444 100644 --- a/src/stlink-lib/usb.h +++ b/src/stlink-lib/usb.h @@ -23,6 +23,7 @@ #define STLINK_USB_PID_STLINK_V3S_PID 0x374f #define STLINK_USB_PID_STLINK_V3_2VCP_PID 0x3753 #define STLINK_USB_PID_STLINK_V3_NO_MSD_PID 0x3754 +#define STLINK_USB_PID_STLINK_V3P 0x3757 #define STLINK_V1_USB_PID(pid) ((pid) == STLINK_USB_PID_STLINK) @@ -36,7 +37,8 @@ (pid) == STLINK_USB_PID_STLINK_V3E_PID || \ (pid) == STLINK_USB_PID_STLINK_V3S_PID || \ (pid) == STLINK_USB_PID_STLINK_V3_2VCP_PID || \ - (pid) == STLINK_USB_PID_STLINK_V3_NO_MSD_PID) + (pid) == STLINK_USB_PID_STLINK_V3_NO_MSD_PID || \ + (pid) == STLINK_USB_PID_STLINK_V3P) #define STLINK_SUPPORTED_USB_PID(pid) (STLINK_V1_USB_PID(pid) || \ STLINK_V2_USB_PID(pid) || \