Skip to content

Commit 9bfb641

Browse files
DrZlo13ideskotopes
authored
[FL-2529][FL-1628] New LF-RFID subsystem (#1601)
* Makefile: unit tests pack * RFID: pulse joiner and its unit test * Move pulse protocol helpers to appropriate place * Drop pulse_joiner tests * Generic protocol, protocols dictionary, unit test * Protocol dict unit test * iButton: protocols dictionary * Lib: varint * Lib: profiler * Unit test: varint * rfid: worker mockup * LFRFID: em4100 unit test * Storage: file_exist function * rfid: fsk osc * rfid: generic fsk demodulator * rfid: protocol em4100 * rfid: protocol h10301 * rfid: protocol io prox xsf * Unit test: rfid protocols * rfid: new hal * rfid: raw worker * Unit test: fix error output * rfid: worker * rfid: plain c cli * fw: migrate to scons * lfrfid: full io prox support * unit test: io prox protocol * SubGHZ: move bit defines to source * FSK oscillator: level duration compability * libs: bit manipulation library * lfrfid: ioprox protocol, use bit library and new level duration method of FSK ocillator * bit lib: unit tests * Bit lib: parity tests, remove every nth bit, copy bits * Lfrfid: awid protocol * bit lib: uint16 and uint32 getters, unit tests * lfrfid: FDX-B read, draft version * Minunit: better memeq assert * bit lib: reverse, print, print regions * Protocol dict: get protocol features, get protocol validate count * lfrfid worker: improved read * lfrfid raw worker: psk support * Cli: rfid plain C cli * protocol AWID: render * protocol em4100: render * protocol h10301: render * protocol indala26: support every indala 26 scramble * Protocol IO Prox: render * Protocol FDX-B: advanced read * lfrfid: remove unused test function * lfrfid: fix os primitives * bit lib: crc16 and unit tests * FDX-B: save data * lfrfid worker: increase stream size. Alloc raw worker only when needed. * lfrfid: indala26 emulation * lfrfid: prepare to write * lfrfid: fdx-b emulation * lfrfid: awid, ioprox write * lfrfid: write t55xx w\o validation * lfrfid: better t55xx block0 handling * lfrfid: use new t5577 functions in worker * lfrfid: improve protocol description * lfrfid: write and verify * lfrfid: delete cpp cli * lfrfid: improve worker usage * lfrfid-app: step to new worker * lfrfid: old indala (I40134) load fallback * lfrfid: indala26, recover wrong synced data * lfrfid: remove old worker * lfrfid app: dummy read screen * lfrfid app: less dummy read screen * lfrfid: generic 96-bit HID protocol (covers up to HID 37-bit) * rename * lfrfid: improve indala26 read * lfrfid: generic 192-bit HID protocol (covers all HID extended) * lfrfid: TODO about HID render * lfrfid: new protocol FDX-A * lfrfid-app: correct worker stop on exit * misc fixes * lfrfid: FDX-A and HID distinguishability has been fixed. * lfrfid: decode HID size header and render it (#1612) * lfrfid: rename HID96 and HID192 to HIDProx and HIDExt * lfrfid: extra actions scene * lfrfid: decode generic HID Proximity size lazily (#1618) * lib: stream of data buffers concept * lfrfid: raw file helper * lfrfid: changed raw worker api * lfrfid: packed varint pair * lfrfid: read stream speedup * lfrfid app: show read mode * Documentation * lfrfid app: raw read gui * lfrfid app: storage check for raw read * memleak fix * review fixes * lfrfid app: read blink color * lfrfid app: reset key name after read * review fixes * lfrfid app: fix copypasted text * review fixes * lfrfid: disable debug gpio * lfrfid: card detection events * lfrfid: change validation color from magenta to green * Update core_defines. * lfrfid: prefix fdx-b id by zeroes * lfrfid: parse up to 43-bit HID Proximity keys (#1640) * Fbt: downgrade toolchain and fix PS1 * lfrfid: fix unit tests * lfrfid app: remove printf * lfrfid: indala26, use bit 55 as data * lfrfid: indala26, better brief format * lfrfid: indala26, loading fallback * lfrfid: read timing tuning Co-authored-by: James Ide <[email protected]> Co-authored-by: あく <[email protected]>
1 parent f92127c commit 9bfb641

File tree

179 files changed

+10234
-4804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+10234
-4804
lines changed

applications/archive/helpers/archive_apps.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,13 @@ bool archive_app_is_available(void* context, const char* path) {
2929

3030
if(app == ArchiveAppTypeU2f) {
3131
bool file_exists = false;
32-
Storage* fs_api = furi_record_open(RECORD_STORAGE);
33-
File* file = storage_file_alloc(fs_api);
34-
35-
file_exists =
36-
storage_file_open(file, ANY_PATH("u2f/key.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
37-
if(file_exists) {
38-
storage_file_close(file);
39-
file_exists =
40-
storage_file_open(file, ANY_PATH("u2f/cnt.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
41-
if(file_exists) {
42-
storage_file_close(file);
43-
}
32+
Storage* storage = furi_record_open(RECORD_STORAGE);
33+
34+
if(storage_file_exists(storage, ANY_PATH("u2f/key.u2f"))) {
35+
file_exists = storage_file_exists(storage, ANY_PATH("u2f/cnt.u2f"));
4436
}
4537

46-
storage_file_free(file);
4738
furi_record_close(RECORD_STORAGE);
48-
4939
return file_exists;
5040
} else {
5141
return false;

applications/archive/helpers/archive_favorites.c

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ uint16_t archive_favorites_count(void* context) {
8282
static bool archive_favourites_rescan() {
8383
string_t buffer;
8484
string_init(buffer);
85-
Storage* fs_api = furi_record_open(RECORD_STORAGE);
86-
File* file = storage_file_alloc(fs_api);
87-
File* fav_item_file = storage_file_alloc(fs_api);
85+
Storage* storage = furi_record_open(RECORD_STORAGE);
86+
File* file = storage_file_alloc(storage);
8887

8988
bool result = storage_file_open(file, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
9089
if(result) {
@@ -101,13 +100,8 @@ static bool archive_favourites_rescan() {
101100
archive_file_append(ARCHIVE_FAV_TEMP_PATH, "%s\n", string_get_cstr(buffer));
102101
}
103102
} else {
104-
bool file_exists = storage_file_open(
105-
fav_item_file, string_get_cstr(buffer), FSAM_READ, FSOM_OPEN_EXISTING);
106-
if(file_exists) {
107-
storage_file_close(fav_item_file);
103+
if(storage_file_exists(storage, string_get_cstr(buffer))) {
108104
archive_file_append(ARCHIVE_FAV_TEMP_PATH, "%s\n", string_get_cstr(buffer));
109-
} else {
110-
storage_file_close(fav_item_file);
111105
}
112106
}
113107
}
@@ -116,12 +110,11 @@ static bool archive_favourites_rescan() {
116110
string_clear(buffer);
117111

118112
storage_file_close(file);
119-
storage_common_remove(fs_api, ARCHIVE_FAV_PATH);
120-
storage_common_rename(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
121-
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
113+
storage_common_remove(storage, ARCHIVE_FAV_PATH);
114+
storage_common_rename(storage, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
115+
storage_common_remove(storage, ARCHIVE_FAV_TEMP_PATH);
122116

123117
storage_file_free(file);
124-
storage_file_free(fav_item_file);
125118
furi_record_close(RECORD_STORAGE);
126119

127120
return result;
@@ -131,9 +124,8 @@ bool archive_favorites_read(void* context) {
131124
furi_assert(context);
132125

133126
ArchiveBrowserView* browser = context;
134-
Storage* fs_api = furi_record_open(RECORD_STORAGE);
135-
File* file = storage_file_alloc(fs_api);
136-
File* fav_item_file = storage_file_alloc(fs_api);
127+
Storage* storage = furi_record_open(RECORD_STORAGE);
128+
File* file = storage_file_alloc(storage);
137129

138130
string_t buffer;
139131
FileInfo file_info;
@@ -163,16 +155,12 @@ bool archive_favorites_read(void* context) {
163155
need_refresh = true;
164156
}
165157
} else {
166-
bool file_exists = storage_file_open(
167-
fav_item_file, string_get_cstr(buffer), FSAM_READ, FSOM_OPEN_EXISTING);
168-
if(file_exists) {
169-
storage_common_stat(fs_api, string_get_cstr(buffer), &file_info);
170-
storage_file_close(fav_item_file);
158+
if(storage_file_exists(storage, string_get_cstr(buffer))) {
159+
storage_common_stat(storage, string_get_cstr(buffer), &file_info);
171160
archive_add_file_item(
172161
browser, (file_info.flags & FSF_DIRECTORY), string_get_cstr(buffer));
173162
file_count++;
174163
} else {
175-
storage_file_close(fav_item_file);
176164
need_refresh = true;
177165
}
178166
}
@@ -183,7 +171,6 @@ bool archive_favorites_read(void* context) {
183171
storage_file_close(file);
184172
string_clear(buffer);
185173
storage_file_free(file);
186-
storage_file_free(fav_item_file);
187174
furi_record_close(RECORD_STORAGE);
188175

189176
archive_set_item_count(browser, file_count);

applications/desktop/animations/animation_manager.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
220220
furi_assert(blocking_animation);
221221
animation_manager->sd_shown_sd_ok = true;
222222
} else if(!animation_manager->sd_shown_no_db) {
223-
bool db_exists = storage_common_stat(storage, EXT_PATH("Manifest"), NULL) == FSE_OK;
224-
if(!db_exists) {
223+
if(!storage_file_exists(storage, EXT_PATH("Manifest"))) {
225224
blocking_animation = animation_storage_find_animation(NO_DB_ANIMATION_NAME);
226225
furi_assert(blocking_animation);
227226
animation_manager->sd_shown_no_db = true;

applications/lfrfid/helpers/decoder_analyzer.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

applications/lfrfid/helpers/decoder_analyzer.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

applications/lfrfid/helpers/decoder_emmarin.cpp

Lines changed: 0 additions & 72 deletions
This file was deleted.

applications/lfrfid/helpers/decoder_emmarin.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

applications/lfrfid/helpers/decoder_gpio_out.cpp

Lines changed: 0 additions & 15 deletions
This file was deleted.

applications/lfrfid/helpers/decoder_gpio_out.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)