Skip to content

Commit

Permalink
Merge branch 'dev' into gsurkov/3643_mf_desfire_crash_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes authored Oct 28, 2023
2 parents bfc19cc + 3d872cf commit 9cd89dc
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void nfc_render_mf_desfire_file_settings_data(
furi_string_cat_printf(str, "size %lu\n", record_size);
break;
case MfDesfireFileTypeValue:
record_size = MF_DESFIRE_VALUE_SIZE;
furi_string_cat_printf(
str, "lo %lu hi %lu\n", settings->value.lo_limit, settings->value.hi_limit);
furi_string_cat_printf(
Expand Down
9 changes: 0 additions & 9 deletions firmware.scons
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ env = ENV.Clone(
"FURI_DEBUG" if ENV["DEBUG"] else "FURI_NDEBUG",
],
},
"nfc": {
"CCFLAGS": [
"-Og",
],
"CPPDEFINES": [
"NDEBUG",
"FURI_DEBUG",
],
},
},
FW_API_TABLE=None,
_APP_ICONS=None,
Expand Down
2 changes: 1 addition & 1 deletion firmware/targets/f18/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,40.0,,
Version,+,40.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
Expand Down
2 changes: 1 addition & 1 deletion firmware/targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,40.0,,
Version,+,40.1,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Expand Down
5 changes: 3 additions & 2 deletions firmware/targets/f7/furi_hal/furi_hal_nfc_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ FuriHalNfcError furi_hal_nfc_event_stop() {

void furi_hal_nfc_event_set(FuriHalNfcEventInternalType event) {
furi_assert(furi_hal_nfc_event);
furi_assert(furi_hal_nfc_event->thread);

furi_thread_flags_set(furi_hal_nfc_event->thread, event);
if(furi_hal_nfc_event->thread) {
furi_thread_flags_set(furi_hal_nfc_event->thread, event);
}
}

FuriHalNfcError furi_hal_nfc_abort() {
Expand Down
2 changes: 1 addition & 1 deletion firmware/targets/f7/furi_hal/furi_hal_nfc_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ void furi_hal_nfc_init_gpio_isr() {
}

void furi_hal_nfc_deinit_gpio_isr() {
furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_remove_int_callback(&gpio_nfc_irq_rfid_pull);
furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
}
2 changes: 1 addition & 1 deletion firmware/targets/f7/furi_hal/furi_hal_nfc_iso15693.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener_alloc() {

instance->signal = iso15693_signal_alloc(&gpio_spi_r_mosi);
instance->parser =
iso15693_parser_alloc(&gpio_spi_r_miso, FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE);
iso15693_parser_alloc(&gpio_nfc_irq_rfid_pull, FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE);

return instance;
}
Expand Down
3 changes: 3 additions & 0 deletions furi/furi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
// FreeRTOS timer, REMOVE AFTER REFACTORING
#include <timers.h>

// Workaround for math.h leaking through HAL in older versions
#include <math.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/nfc/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ env.Append(
libenv = env.Clone(FW_LIB_NAME="nfc")
libenv.ApplyLibFlags()

sources = libenv.GlobRecursive("*.c*", exclude="deprecated/*c")
sources = libenv.GlobRecursive("*.c*")

lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
libenv.Install("${LIB_DIST_DIR}", lib)
Expand Down
1 change: 1 addition & 0 deletions lib/nfc/protocols/mf_desfire/mf_desfire.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {
#define MF_DESFIRE_UID_SIZE (7)
#define MF_DESFIRE_BATCH_SIZE (5)
#define MF_DESFIRE_APP_ID_SIZE (3)
#define MF_DESFIRE_VALUE_SIZE (4)

typedef struct {
uint8_t hw_vendor;
Expand Down
2 changes: 1 addition & 1 deletion lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ MfDesfireError mf_desfire_poller_async_read_file_records(
furi_assert(instance);

bit_buffer_reset(instance->input_buffer);
bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_DATA);
bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_RECORDS);
bit_buffer_append_byte(instance->input_buffer, id);
bit_buffer_append_bytes(instance->input_buffer, (const uint8_t*)&offset, 3);
bit_buffer_append_bytes(instance->input_buffer, (const uint8_t*)&size, 3);
Expand Down
2 changes: 1 addition & 1 deletion lib/nfc/protocols/mf_ultralight/mf_ultralight.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ bool mf_ultralight_load(MfUltralightData* data, FlipperFormat* ff, uint32_t vers
uint32_t pages_total = 0;
if(!flipper_format_read_uint32(ff, MF_ULTRALIGHT_PAGES_TOTAL_KEY, &pages_total, 1)) break;
uint32_t pages_read = 0;
if(data_format_version < mf_ultralight_data_format_version) {
if(data_format_version < mf_ultralight_data_format_version) { //-V547
pages_read = pages_total;
} else {
if(!flipper_format_read_uint32(ff, MF_ULTRALIGHT_PAGES_READ_KEY, &pages_read, 1))
Expand Down
2 changes: 2 additions & 0 deletions lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ static uint16_t mf_ultralight_get_upper_page_bound(MfUltralightType type) {
upper_page_bound = 511;
else if(type == MfUltralightTypeNTAGI2C2K)
upper_page_bound = 479;
else if(type == MfUltralightTypeNTAGI2C1K)
upper_page_bound = 225;
else {
upper_page_bound = mf_ultralight_get_config_page_num(type) - 2;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/signal_reader/parsers/iso15693/iso15693_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Iso15693Parser* iso15693_parser_alloc(const GpioPin* pin, size_t max_frame_size)
signal_reader_set_sample_rate(
instance->signal_reader, SignalReaderTimeUnit64Mhz, ISO15693_PARSER_BITRATE_F64MHZ);
signal_reader_set_pull(instance->signal_reader, GpioPullDown);
signal_reader_set_polarity(instance->signal_reader, SignalReaderPolarityInverted);
signal_reader_set_polarity(instance->signal_reader, SignalReaderPolarityNormal);
signal_reader_set_trigger(instance->signal_reader, SignalReaderTriggerRisingFallingEdge);

return instance;
Expand Down

0 comments on commit 9cd89dc

Please sign in to comment.