From c327578c7da744ed3b39643d0436e68b09045a99 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 11 Oct 2011 23:41:49 +0000 Subject: [PATCH] Use defined VID/PIDs instead of magic numbers --- src/stlink-common.h | 1 + src/stlink-usb.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stlink-common.h b/src/stlink-common.h index 3e5d461..d1ad32d 100644 --- a/src/stlink-common.h +++ b/src/stlink-common.h @@ -23,6 +23,7 @@ extern "C" { // st-link vendor cmd's #define USB_ST_VID 0x0483 #define USB_STLINK_PID 0x3744 +#define USB_STLINK_32L_PID 0x3748 // STLINK_DEBUG_RESETSYS, etc: #define STLINK_OK 0x80 diff --git a/src/stlink-usb.c b/src/stlink-usb.c index 50a7d58..e30a980 100644 --- a/src/stlink-usb.c +++ b/src/stlink-usb.c @@ -136,10 +136,10 @@ static int is_stlink_device(libusb_device * dev) { printf("device: 0x%04x, 0x%04x\n", desc.idVendor, desc.idProduct); - if (desc.idVendor != 0x0483) + if (desc.idVendor != USB_ST_VID) return 0; - if (desc.idProduct != 0x3748) + if (desc.idProduct != USB_STLINK_32L_PID) return 0; return 1;