/***************************************************************************
- *   Copyright (C) 2011 by Mathias Kuester                                 *
+ *   Copyright (C) 2011-2012 by Mathias Kuester                            *
  *   Mathias Kuester <kesmtp@freenet.de>                                   *
  *                                                                         *
  *   This code is based on https://github.com/texane/stlink                *
 #define STLINK_DEV_MASS_MODE                   0x01
 #define STLINK_DEV_DEBUG_MODE                  0x02
 #define STLINK_DEV_SWIM_MODE                   0x03
+#define STLINK_DEV_BOOTLOADER_MODE             0x04
 #define STLINK_DEV_UNKNOWN_MODE                        -1
 
 #define STLINK_DFU_EXIT                                0x07
                case STLINK_DEV_SWIM_MODE:
                        emode = STLINK_MODE_DEBUG_SWIM;
                        break;
+               case STLINK_DEV_BOOTLOADER_MODE:
                default:
                        emode = STLINK_MODE_UNKNOWN;
                        break;
        else
                h->txbuf[1] = STLINK_DEBUG_APIV2_READALLREGS;
 
-
        res = stlink_usb_recv(handle, h->txbuf, STLINK_CMD_SIZE, h->rxbuf, 84);
 
        if (res != ERROR_OK)