mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 09:01:24 +02:00
Add set_atr for a rescue ATR.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -256,4 +256,6 @@ extern bool has_set_rtc(void);
|
|||||||
extern time_t get_rtc_time(void);
|
extern time_t get_rtc_time(void);
|
||||||
extern void set_rtc_time(time_t tv_sec);
|
extern void set_rtc_time(time_t tv_sec);
|
||||||
|
|
||||||
|
extern int set_atr(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
22
src/rescue.c
22
src/rescue.c
@@ -39,15 +39,15 @@ const uint8_t rescue_aid[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef PICO_RP2350
|
#ifdef PICO_RP2350
|
||||||
#define PICO_MCU 1
|
const uint8_t PICO_MCU = 1;
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
#define PICO_MCU 2
|
const uint8_t PICO_MCU = 2;
|
||||||
#elif defined(ENABLE_EMULATION)
|
#elif defined(ENABLE_EMULATION)
|
||||||
#define PICO_MCU 3
|
const uint8_t PICO_MCU = 3;
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||||
#define PICO_MCU 4
|
const uint8_t PICO_MCU = 4;
|
||||||
#else
|
#else
|
||||||
#define PICO_MCU 0
|
const uint8_t PICO_MCU = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EF_DEVCERT_KEY 0xE0C1
|
#define EF_DEVCERT_KEY 0xE0C1
|
||||||
@@ -73,6 +73,18 @@ static int rescue_select(app_t *a, uint8_t force) {
|
|||||||
return PICOKEY_OK;
|
return PICOKEY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t atr_rescue[] = {
|
||||||
|
24,
|
||||||
|
0x3B, 0xFE, 0x18, 0x00, 0x00, 0x81, 0x31, 0xFE, 0x45, 0x80, 0x31, 0x81, 0x54, 0x48, 0x53, 0x4D,
|
||||||
|
0x31, 0x73, 0x80, 0x21, 0x40, 0x81, 0x07, 0xFA
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const uint8_t *ccid_atr;
|
||||||
|
__attribute__((weak)) int set_atr(void) {
|
||||||
|
ccid_atr = atr_rescue;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
INITIALIZER ( rescue_ctor ) {
|
INITIALIZER ( rescue_ctor ) {
|
||||||
register_app(rescue_select, rescue_aid);
|
register_app(rescue_select, rescue_aid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ void usb_init(void)
|
|||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
usb_desc_setup();
|
usb_desc_setup();
|
||||||
#endif
|
#endif
|
||||||
|
set_atr();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PICO_PLATFORM
|
#ifdef PICO_PLATFORM
|
||||||
|
|||||||
Reference in New Issue
Block a user