Skip to content

Commit

Permalink
Merge pull request #29 from Next-Flip/js-backport-of-backport
Browse files Browse the repository at this point in the history
Fixes for FW PR 270, more app updates
  • Loading branch information
Willy-JL authored Oct 19, 2024
2 parents 36671ed + 2d045b7 commit 14cdbee
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion seader/ccid.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ size_t seader_ccid_process(Seader* seader, uint8_t* cmd, size_t cmd_len) {
FURI_LOG_W(
TAG,
"Invalid LRC. Recv: %02x vs Calc: %02x",
cmd[2 + 10 + message.dwLength + 1],
cmd[2 + 10 + message.dwLength],
seader_calc_lrc(cmd, 2 + 10 + message.dwLength));
// TODO: Should I respond with an error?
return message.consumed;
Expand Down
6 changes: 5 additions & 1 deletion seader/seader_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#define APDU_HEADER_LEN 5
#define ASN1_PREFIX 6
#define ASN1_DEBUG true
// #define ASN1_DEBUG true

#define RFAL_PICOPASS_TXRX_FLAGS \
(FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_TX_MANUAL | FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | \
Expand Down Expand Up @@ -384,6 +384,10 @@ NfcCommand seader_worker_poller_callback_picopass(PicopassPollerEvent event, voi
seader_worker_poller_conversation(seader, &spc);
} else if(seader_worker->stage == SeaderPollerEventTypeComplete) {
ret = NfcCommandStop;
} else if(seader_worker->stage == SeaderPollerEventTypeFail) {
view_dispatcher_send_custom_event(
seader->view_dispatcher, SeaderCustomEventWorkerExit);
ret = NfcCommandStop;
}
} else if(event.type == PicopassPollerEventTypeFail) {
ret = NfcCommandStop;
Expand Down
2 changes: 1 addition & 1 deletion totp/.gitsubtree
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/xMasterX/all-the-plugins dev base_pack/totp 4558d74c9da36abc851edd96a95d18f7d5511a75
https://github.com/xMasterX/all-the-plugins dev base_pack/totp d62ae7e4a951e348e43cb76e492173aedf4897ee
https://github.com/akopachov/flipper-zero_authenticator master totp b147fbb3e9055fa8e119f69d4e9e84c0740b9d4e
1 change: 1 addition & 0 deletions totp/app_api_table_i.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdbool.h>
#include <cli/cli.h>
#include <cli/cli_ansi.h>
#include <lib/print/wrappers.h>
#include <lib/toolbox/args.h>
#include <memset_s.h>
Expand Down
1 change: 1 addition & 0 deletions totp/cli/cli.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cli/cli.h>
#include <cli/cli_ansi.h>
#include "../types/plugin_state.h"

typedef struct TotpCliContext TotpCliContext;
Expand Down
1 change: 1 addition & 0 deletions totp/cli/cli_plugin_interface.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cli/cli.h>
#include <cli/cli_ansi.h>
#include <furi/core/string.h>
#include "../types/plugin_state.h"

Expand Down
9 changes: 5 additions & 4 deletions totp/cli/cli_shared_methods.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "cli_shared_methods.h"
#include <cli/cli.h>
#include <cli/cli_ansi.h>
#include <lib/toolbox/args.h>
#include "cli_helpers.h"
#include "../types/plugin_event.h"
Expand Down Expand Up @@ -35,13 +36,13 @@ void totp_cli_force_close_app(void* ctx) {
bool totp_cli_read_line(Cli* cli, FuriString* out_str, bool mask_user_input) {
uint8_t c;
while(cli_read(cli, &c, 1) == 1) {
if(c == CliSymbolAsciiEsc) {
if(c == CliKeyEsc) {
// Some keys generating escape-sequences
// We need to ignore them as we care about alpha-numerics only
uint8_t c2;
cli_read_timeout(cli, &c2, 1, 0);
cli_read_timeout(cli, &c2, 1, 0);
} else if(c == CliSymbolAsciiETX) {
} else if(c == CliKeyETX) {
cli_nl(cli);
return false;
} else if(
Expand All @@ -54,13 +55,13 @@ bool totp_cli_read_line(Cli* cli, FuriString* out_str, bool mask_user_input) {
}
fflush(stdout);
furi_string_push_back(out_str, c);
} else if(c == CliSymbolAsciiBackspace || c == CliSymbolAsciiDel) {
} else if(c == CliKeyBackspace || c == CliKeyDEL) {
size_t out_str_size = furi_string_size(out_str);
if(out_str_size > 0) {
TOTP_CLI_DELETE_LAST_CHAR();
furi_string_left(out_str, out_str_size - 1);
}
} else if(c == CliSymbolAsciiCR) {
} else if(c == CliKeyCR) {
cli_nl(cli);
break;
}
Expand Down
1 change: 1 addition & 0 deletions totp/cli/cli_shared_methods.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cli/cli.h>
#include <cli/cli_ansi.h>
#include "../types/plugin_state.h"

#ifdef __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions totp/cli/plugins/delete/delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
char user_pick;
do {
user_pick = tolower(cli_getc(cli));
} while(user_pick != 'y' && user_pick != 'n' && user_pick != CliSymbolAsciiCR &&
user_pick != CliSymbolAsciiETX && user_pick != CliSymbolAsciiEsc);
} while(user_pick != 'y' && user_pick != 'n' && user_pick != CliKeyCR &&
user_pick != CliKeyETX && user_pick != CliKeyEsc);

confirmed = user_pick == 'y' || user_pick == CliSymbolAsciiCR;
confirmed = user_pick == 'y' || user_pick == CliKeyCR;
}

if(confirmed) {
Expand Down
8 changes: 4 additions & 4 deletions totp/cli/plugins/pin/pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static bool totp_cli_read_pin(Cli* cli, uint8_t* pin, uint8_t* pin_length) {
uint8_t c;
*pin_length = 0;
while(cli_read(cli, &c, 1) == 1) {
if(c == CliSymbolAsciiEsc) {
if(c == CliKeyEsc) {
uint8_t c2;
uint8_t c3;
if(cli_read_timeout(cli, &c2, 1, 0) == 1 && cli_read_timeout(cli, &c3, 1, 0) == 1 &&
Expand All @@ -55,17 +55,17 @@ static bool totp_cli_read_pin(Cli* cli, uint8_t* pin, uint8_t* pin_length) {
fflush(stdout);
}
}
} else if(c == CliSymbolAsciiETX) {
} else if(c == CliKeyETX) {
TOTP_CLI_DELETE_CURRENT_LINE();
TOTP_CLI_PRINTF_INFO("Cancelled by user\r\n");
return false;
} else if(c == CliSymbolAsciiBackspace || c == CliSymbolAsciiDel) {
} else if(c == CliKeyBackspace || c == CliKeyDEL) {
if(*pin_length > 0) {
*pin_length = *pin_length - 1;
pin[*pin_length] = 0;
TOTP_CLI_DELETE_LAST_CHAR();
}
} else if(c == CliSymbolAsciiCR) {
} else if(c == CliKeyCR) {
cli_nl(cli);
break;
}
Expand Down

0 comments on commit 14cdbee

Please sign in to comment.