Fix enabled capabilities detection.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -63,7 +63,7 @@ bool cap_supported(uint16_t cap) {
|
|||||||
if (tag == TAG_USB_ENABLED) {
|
if (tag == TAG_USB_ENABLED) {
|
||||||
uint16_t ecaps = tag_data[0];
|
uint16_t ecaps = tag_data[0];
|
||||||
if (tag_len == 2) {
|
if (tag_len == 2) {
|
||||||
ecaps = (tag_data[1] << 8) | tag_data[0];
|
ecaps = (tag_data[0] << 8) | tag_data[1];
|
||||||
}
|
}
|
||||||
return (ecaps & cap);
|
return (ecaps & cap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,10 +176,10 @@ extern int calculate_oath(uint8_t truncate,
|
|||||||
static uint8_t session_counter[2] = {0};
|
static uint8_t session_counter[2] = {0};
|
||||||
#endif
|
#endif
|
||||||
int otp_button_pressed(uint8_t slot) {
|
int otp_button_pressed(uint8_t slot) {
|
||||||
|
init_otp();
|
||||||
if (!cap_supported(CAP_OTP)) {
|
if (!cap_supported(CAP_OTP)) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
init_otp();
|
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
file_t *ef = search_dynamic_file(slot == 1 ? EF_OTP_SLOT1 : EF_OTP_SLOT2);
|
file_t *ef = search_dynamic_file(slot == 1 ? EF_OTP_SLOT1 : EF_OTP_SLOT2);
|
||||||
const uint8_t *data = file_get_data(ef);
|
const uint8_t *data = file_get_data(ef);
|
||||||
|
|||||||
Reference in New Issue
Block a user