Commit Graph

13233 Commits

Author SHA1 Message Date
jay candel
65df2e4d1f NFC: SmartRider Parser (#203)
* adding smartrider_parser

* adding SmartRider parser

new parser for SmartRider cards, a public transport smart card system used in Western Australia.
extracts and interprets key information from the card, including:
-Current balance
-Card serial number
-Concession type
-Purchase cost
-Details of the last two trips (including tag on/off status, cost, route, transaction number, and journey number)

* optimising

- removed all logging to simplify output.
- used early returns for clearer error handling.
- optimized setups outside loops to improve memory use.
- simplified flows by removing unnecessary loops.
- placed variables closer to their use for better readability.
- cached data blocks to streamline data handling.
- added a helper function for parsing trips, reducing redundancy.
- corrected loop counter types to avoid compile-time errors.

* cleaning displayed data

- removed transaction (txn) and journey (jrn) numbers to declutter the trip details.
- shortened "previous trip" to "prev trip" to optimize screen space usage.

* added and refined displayed data

added auto load field "threshold amount / reload amount"
changed serial to display first two digits as SR0 for consistency with physical card.

* Format

* Improved Verification Process

- Added definitions for STANDARD_KEY_2 and STANDARD_KEY_3
- Enhanced smartrider_verify function to check for all three specific keys:
  - STANDARD_KEY_1 in Sector 0 as Key A
  - STANDARD_KEY_2 in Sector 6 as Key A
  - STANDARD_KEY_3 in Sector 6 as Key B
- Implemented read operations to verify actual key values stored on the card
- Added comparisons between read key data and expected key values
- Improved debug logging for each step of the verification process

* Integrated Verification into Parse Function

- Added key verification for sectors 0 and 6
- Implemented do-while loop structure for early exit on verification failure
- Moved block readability checks inside verification process
- Added parsed flag to indicate successful parsing
- Updated return value to reflect parsing success
- Maintained existing parsing logic and output format

* fixed false positives

recieved some cuid cards today so was able to test for myself can confirm works... finally
changes made: 
-updated key assignment in smartrider_read
-simplified key verification in smartrider_parse
-improved error handling and logging
-streamlined data parsing process
-corrected key checking logic
-added checks for required block readability
-improved flow control with strategic breaks
-adjusted block data access method

* small optimizations

- refactored `smartrider_verify` and `smartrider_read` by abstracting repeated key operations into `authenticate_and_read` function for improved code maintainability.
- optimized `smartrider_read` by introducing a loop for key setup, reducing redundancy and improving efficiency.
- streamlined error handling in `smartrider_read` by replacing do-while loop with conditional checks.
- changed standard key references to use `standard_keys` array indices

* formatting

* Delete duplicate smartrider.c

* updated smartrider.c

* found 'fbt format'

* transaction parsing updates

-removed last trip/prev trip wording and replaced with "Trip History" header
-added date in front of each transaction 
-only shows transaction cost if it's higher than 0
-changed tag on/tag off to +/- to save room
-added 8 more transactions to Trip History
-verified still working and formatted with fbt

* fixed reboot with partially unlocked card

-added bounds checking for all block accesses to prevent out-of-range memory access
-implemented improved error handling with an error_occurred flag
-introduced a maximum iteration count for date calculation to prevent infinite loops
-used snprintf with size limits for all string operations to avoid buffer overflows
-added validation for trip count to ensure it doesn't exceed the maximum allowed
-implemented checks to skip unread or out-of-range blocks during trip parsing
-added safeguards against corrupted or invalid timestamp data

* optimized SmartRider card parsing and verification

- replaced do-while loop with direct error checks in smartrider_parse
- optimized key verification using direct memcmp in smartrider_verify
- introduced inline functions for common operations (e.g., set_key, read_le16)
- replaced bubble sort with insertion sort for trip data
- simplified date calculation using a lookup table for days in month
- used uint_fast8_t for loop counters to allow compiler optimization
- added __attribute__((hot)) to key functions for aggressive optimization
- removed redundant variable declarations and function calls
- optimized memory usage with static const arrays for required blocks
- simplified error handling in smartrider_read and authenticate_and_read
- used __builtin_memcpy and __builtin_memcmp for potential compiler optimizations
- tested and formatted with fbt

* small fixes

-renamed "Trip History" to "Tag On/Off History"
-fixed date calculation to account for leap years
-misc changes

* Update changelog

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
2024-09-18 03:00:49 +02:00
m7i-org
df273950cc Sub-GHz: Show satellites count with an icon (#215)
* feat(subghz): show satellites if enabled

Replaces the display of the number of satellites during SubGHz scanning. If GPS is enabled (an an external module connected) it will blink a GPS icon with the number of sats currently in range (even if zero).
Using a 10x10px "positioning" icon that replaces the SubGHz icon on the bottom right.

* Revert api version to ofw release

* f18 too

* Tweak icon a little

* Update changelog

* Format

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
2024-09-18 01:43:30 +02:00
m7i-org
3351f9b636 Sub-GHz: Add Bresser 3CH weather station protocol (#217)
* feat(subghz): added Bresser 3CH weather station

Added the Bresser 3CH, a weather station supported by rtl_433 already.

* Update changelog

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
2024-09-18 01:14:29 +02:00
Willy-JL
2ed1366b67 Add PR number --nobuild 2024-09-17 23:50:52 +01:00
Mihai
425a97fe95 NFC: Added 6 new Mifare Classic keys from Bulgaria Hotel (#216)
* Update mf_classic_dict.nfc

Added 6 new keys from Bulgaria Hotel
Keys are not duplicated!

* Add section delimiter

* No LF at EOF

* Update changelog

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
2024-09-18 00:24:21 +02:00
Willy-JL
de5b0a42d1 Add Sub-GHz: Radio Scanner app (by RocketGod-git) 2024-09-17 23:18:03 +01:00
Willy-JL
2b8159fcd6 Picopass: Force ISO15693 1OutOf4 mode (by aaronjamt)
- Fixes crashes in some noisy readers
2024-09-17 23:13:35 +01:00
Willy-JL
f6025cee28 Revert, app is not ready for new lib yet
maybe git subtrees need some more work, to better sync with submodule indexes?
2024-09-17 22:39:26 +01:00
Aaron Tulino
5afc01a4c3 NFC: Add API to enforce ISO15693 mode (#225)
* Add API to enforce ISO15693 mode
See https://github.com/flipperdevices/flipperzero-firmware/pull/3885

* Revert symbols version

* Format

* Update changelog

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
2024-09-17 23:32:03 +02:00
Willy-JL
12f9bd73b7 Update apps --nobuild
- Laser Tag: Crash fixes (by RocketGod-git), thread leak fix (by jamisonderek)
- Pokemon Trading: Update gblink library with printer support (by kbembedded)
2024-09-17 22:20:58 +01:00
Willy-JL
8d43f8f7cc Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild 2024-09-17 22:03:37 +01:00
Willy-JL
d1bc8e53f3 Merge remote-tracking branch 'ofw/dev' into mntm-dev --nobuild 2024-09-17 22:02:22 +01:00
MX
31df2c0655 upd changelog 2024-09-16 19:17:05 +03:00
MX
2826382970 fix check [ci skip] 2024-09-16 18:31:02 +03:00
MX
2af87cdb70 hollarm button codes and gangqi validator allow more serials [ci skip] 2024-09-16 18:01:51 +03:00
MX
521de2bc04 Merge remote-tracking branch 'OFW/dev' into dev 2024-09-16 18:00:02 +03:00
EntranceJew
913a86bbec kerel typo (#3901)
Co-authored-by: あく <alleteam@gmail.com>
2024-09-15 16:07:04 +01:00
porta
19a3736fe5 [FL-3891] Folder rename fails (#3896)
* fix, refactor: storage is_subdir API
* docs: fix incorrect comment
* test: new storage apis
* test: use temporary path
* style: fix formatting
* UnitTest: storage path macros naming
* UnitTest: storage path macros naming part 2

Co-authored-by: あく <alleteam@gmail.com>
2024-09-15 16:01:42 +01:00
Willy-JL
9c54336f1d Update apps
- Quac!: iButton support (by rdefeo)
- DTMF Dolphin: Add EAS tone support (by JendrBendr)
2024-09-14 03:02:53 +02:00
Willy-JL
0ce62a0792 Update changelog 2024-09-14 02:37:53 +02:00
Willy-JL
3c1ff413e2 Add some docs of Unleashed FW, adapted to Momentum and with credits 2024-09-14 02:34:40 +02:00
Willy-JL
1fec32daa1 Merge remote-tracking branch 'ul/dev' into mntm-dev 2024-09-14 01:30:48 +02:00
Willy-JL
b31dec8e71 Merge remote-tracking branch 'ofw/dev' into mntm-dev 2024-09-14 01:10:44 +02:00
MX
891a6c047a Merge remote-tracking branch 'OFW/dev' into dev 2024-09-13 22:26:58 +03:00
porta
b670d5b6e2 [FL-3885] Put errno into TCB (#3893)
* feat: thread-safe errno
* ci: fix pvs warning
* ci: silence pvs warning
* fix: 🤯
* test: convert test app into a unit test
2024-09-13 18:31:07 +01:00
porta
0428e82b14 Fix USB-UART bridge exit screen stopping the bridge prematurely (#3892)
* fix: exit screen stopping bridge prematurely
* refactor: merge exit confirmation scene into main usb uart scene
2024-09-12 17:32:07 +01:00
MX
c2f6ce7e54 upd readme [ci skip] 2024-09-11 03:00:09 +03:00
MX
f9f2938bd4 upd changelog 2024-09-11 02:28:00 +03:00
MX
1ca240b624 princeton custom buttons support [ci skip] 2024-09-11 01:59:41 +03:00
MMX
69598746bc Merge pull request #805 from chrostino/patch-1
Update SubGHzRemoteProg.md to improve BFT Mitto steps
2024-09-11 01:58:56 +03:00
MX
2aa4797b12 Merge remote-tracking branch 'OFW/portasynthinca3/usbuart-stay-fix' into dev 2024-09-11 01:44:29 +03:00
chrostino
117e1789c1 Update SubGHzRemoteProg.md
Improved the description steps to create a new remote BFT Mitto with more detailed and accurate instructions
2024-09-10 22:30:58 +02:00
Willy-JL
c0d8659a2c Fix API symbols version for OFW 1.0.1 2024-09-10 20:38:32 +02:00
Willy-JL
0477dc4d9f Add NFC Cyborg Detector app by RocketGod-git 2024-09-10 20:33:04 +02:00
Willy-JL
e38a684193 Update apps 2024-09-10 20:27:35 +02:00
Willy-JL
22eaddee1e Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild
# Conflicts:
#	applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c
2024-09-10 19:21:37 +02:00
Anna Antonenko
c1a009aed0 fix: exit screen stopping bridge prematurely 2024-09-10 19:58:44 +03:00
MX
c1d31edda1 upd changelog 2024-09-10 06:12:13 +03:00
MX
ce53ed2a7c fix wrong menu order [ci skip] 2024-09-10 06:03:54 +03:00
MX
876cbc40b7 Merge remote-tracking branch 'OFW/dev' into dev 2024-09-10 05:48:55 +03:00
Willy-JL
26959f73d8 Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild 2024-09-10 01:03:42 +02:00
Willy-JL
c1ba3e34cb Merge remote-tracking branch 'ofw/dev' into mntm-dev 2024-09-09 23:23:14 +02:00
Willy-JL
e282d8050f Merge remote-tracking branch 'ofw/dev' into mntm-dev 2024-09-09 23:20:14 +02:00
RebornedBrain
5f4f4fcc60 FeliCa anti-collision fix (#3889)
* System code added to felica hal config functions
* Felica sensf_res setup logic adjusted with new struct
* Set api symbols version to 73.0
* Felica unit tests fix
* Furi: prevent use after free on xEventGroupSetBits call

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-09-09 22:11:53 +01:00
Zinong Li
78c5dd95d8 LFRFID GProxII Fix Writing and Rendering Conflict (#3888) 2024-09-09 18:23:18 +01:00
MX
533fe10738 upd changelog 2024-09-09 05:15:29 +03:00
MX
80ad381eef extra checks [ci skip] 2024-09-09 05:13:02 +03:00
MX
b6644d7727 merge fixes [ci skip] 2024-09-09 04:13:10 +03:00
MX
7711b2daae Merge remote-tracking branch 'OFW/dev' into dev 2024-09-09 04:11:35 +03:00
MX
5da447a2b0 more chance to generate working remote at gangqi 2024-09-09 04:11:00 +03:00