+ stlink_t* sl = NULL;
+ sl = stlink_v1_open(0, 1);
+ if (sl == NULL)
+ sl = stlink_open_usb(0, 1, NULL);
+
+ return sl;
+}
+
+static int print_data(char **av)
+{
+ stlink_t* sl = NULL;
+
+ // Probe needs all devices unclaimed
+ if (strcmp(av[1], "--probe") == 0) {
+ stlink_probe();
+ return 0;
+ }
+
+ sl = stlink_open_first();
+
+ if (sl == NULL) {
+ return -1;
+ }
+
+ sl->verbose = 0;
+
+ if (stlink_current_mode(sl) == STLINK_DEV_DFU_MODE)
+ stlink_exit_dfu_mode(sl);
+
+ if (stlink_current_mode(sl) != STLINK_DEV_DEBUG_MODE)
+ stlink_enter_swd_mode(sl);
+