Use defined VID/PIDs instead of magic numbers
[fw/stlink] / src / stlink-usb.c
index 847b7f99c39cddd18486f466ae82dd1029582e7a..e30a98060138f85a8f7d901e0161387725fae8cd 100644 (file)
@@ -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;
@@ -199,12 +199,7 @@ int _stlink_usb_current_mode(stlink_t * sl) {
 
     /* mode = (int)read_uint16(buf, 0); */
     mode = (int) buf[0];
-
-#if 1 /* DEBUG */
-    printf("mode == 0x%x\n", mode);
-#endif /* DEBUG */
-
-
+    DD(sl, "mode == 0x%x\n", mode);
     return mode;
 }
 
@@ -380,7 +375,7 @@ void _stlink_usb_read_mem32(stlink_t *sl, uint32_t addr, uint16_t len) {
     stlink_print_data(sl);
 }
 
-void _stlink_usb_read_all_regs(stlink_t *sl) {
+void _stlink_usb_read_all_regs(stlink_t *sl, reg *regp) {
     DD(sl, "oops! read_all_regs not implemented for USB!\n");
 }
 
@@ -413,7 +408,8 @@ stlink_backend_t _stlink_usb_backend = {
     _stlink_usb_read_all_regs,
     _stlink_usb_read_reg,
     _stlink_usb_write_reg,
-    _stlink_usb_step
+    _stlink_usb_step,
+    _stlink_usb_current_mode
 };