kopia lustrzana https://github.com/stlink-org/stlink
Use defined VID/PIDs instead of magic numbers
rodzic
05c3c496a6
commit
c327578c7d
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Ładowanie…
Reference in New Issue