Add reboot extra command.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-11-27 21:48:04 +01:00
parent a242a28394
commit 866aac8fe3
2 changed files with 17 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
#include "mbedtls/ecdh.h"
#ifdef PICO_PLATFORM
#include "pico/aon_timer.h"
#include "hardware/watchdog.h"
#else
#include <sys/time.h>
#include <time.h>
@@ -35,6 +36,7 @@
#define CMD_DATETIME 0xA
#define CMD_DYNOPS 0x6
#define CMD_SECURE_LOCK 0x3A
#define CMD_REBOOT 0xFB
#define SECURE_LOCK_KEY_AGREEMENT 0x1
#define SECURE_LOCK_ENABLE 0x2
#define SECURE_LOCK_MASK 0x3
@@ -287,6 +289,14 @@ int cmd_extras() {
}
}
}
#endif
#ifdef PICO_PLATFORM
else if (P1(apdu) == CMD_REBOOT) {
if (apdu.nc != 0) {
return SW_WRONG_LENGTH();
}
watchdog_reboot(0, 0, 100);
}
#endif
else {
return SW_INCORRECT_P1P2();