Skip to content

Commit

Permalink
OTP callbacks must be initialized on ctor.
Browse files Browse the repository at this point in the history
Fixes #30.

Signed-off-by: Pol Henarejos <[email protected]>
  • Loading branch information
polhenarejos committed Nov 21, 2023
1 parent a9be759 commit 1d9107d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/fido/otp.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ void init_otp() {
}
scanned = true;
low_flash_available();
#ifndef ENABLE_EMULATION
hid_set_report_cb = otp_hid_set_report_cb;
hid_get_report_cb = otp_hid_get_report_cb;
#endif
}
}
extern int calculate_oath(uint8_t truncate,
Expand Down Expand Up @@ -337,6 +333,10 @@ int otp_button_pressed(uint8_t slot) {
void __attribute__((constructor)) otp_ctor() {
register_app(otp_select, otp_aid);
button_pressed_cb = otp_button_pressed;
#ifndef ENABLE_EMULATION
hid_set_report_cb = otp_hid_set_report_cb;
hid_get_report_cb = otp_hid_get_report_cb;
#endif
}

int otp_unload() {
Expand Down Expand Up @@ -599,8 +599,6 @@ uint16_t otp_hid_get_report_cb(uint8_t itf,
(void) report_type;
(void) buffer;
(void) reqlen;
printf("get_report %d %d %d\n", itf, report_id, report_type);
DEBUG_PAYLOAD(buffer, reqlen);
uint16_t send_buffer_size = *get_send_buffer_size(ITF_KEYBOARD);
if (send_buffer_size > 0) {
uint8_t seq = otp_curr_seq++;
Expand Down

0 comments on commit 1d9107d

Please sign in to comment.