* mf classic listener: reset state before sleep and after nack
* Fix PVS warnings
* Fix PVS and compiler disagree on builtins
Co-authored-by: あく <alleteam@gmail.com>
* nfc_util_bytes2num_little_endian function added
* f18 target api version sync
* Bump api version
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
* New scenes for ultralight poller write mode
* Added new button and transition logic for write operation
For now write is only possible for NTAG21x cards with default password and no AUTHLIM set
* Poller states extended
* Enums and datatypes extended for new poller mode
* Added mode field to poller instance datatype
* New states for poller added in order to implement write mode
* Added new event type for locked cards in order to simplify state flow
* New logic for poller write commands
* Scenes adjustments
* Scenes renamed
* New field added to poller instance
* Now we write in 'page per call' mode
* Now function takes callback return value into account
* Callback will be called only in write mode
* Event type added
* Log adjusted and start page to write set
* Logs added and check in now false at start, then it moves to true
* Now mf_ultralight_poller_handler_request_write_data halts card in case of check failure and stops poller
* All fail events now returns NfcCommandStop callback
* In case of fail we move back properly
* Remove garbage
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* nfc: st25tb: rework async poller
* nfc: st25tb: introduce sync poller
* nfc: st25tb: add write support
* nfc: st25tb: rewrite poller to use better states
* nfc: st25tb: move to mode request state after success
* nfc: st25tb: minor bug fixes
* type wasn't properly set on ready event
* sending NfcCustomEventPollerFailure on St25tbPollerEventTypeFailure caused poller to being freed and ultimately resulted in a thread crash
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
* Update Mifare Classic generators to create more accuate data
* Check the transfer buffer validity for NACK
* Fix the AC issues
* CRC errors don't really affect emulation, checking for them isn't worth it
* Make ATQA logic a bit easier to understand
* mf classic: change log level
* mf classic: fix log level
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* Added basic template of Felica listener
* Raw nfc felica listener functions
* Added functions to setup chip for felica listener
* Cleanup function templates from unnecessary parts
* Removed todo comment
* Updated api versions
* Adjusted chip config for felica
* Set proper chip passive target mode for felica
* Added felica function to unit tests
* Update furi_hal_nfc_felica.c
* Removed duplication
Co-authored-by: gornekich <n.gorbadey@gmail.com>
* Unit tests: add "exists" to furi_record tests
* Unit tests: mu_warn, storage 64k test
* Storage: read/write over 64k
* Unit tests: moar tests for storage r/w for >64k cases
* Apps, libs: replace uint16_t with size_t on storage r/w operations
* Unit tests: better data pattern, subghz: warning if transmission is prohibited
Co-authored-by: あく <alleteam@gmail.com>
* Add Mastercode SubGHz Protocol
* Add 2 valid raw files and cleanup code
* Add tests to the two Raw Files
* Remove extra test & delete comments
* Fixes pulse length and shows correct Key
Co-authored-by: FlipperZelebro <flipperzelebro [at] gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* Listener log level changed to Trace
* Show pages count without pwd pages in case of no auth success
* Fixed unit tests
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* Furi: remove direct FreeRTOS timers use
* Furi: eliminate FreeRTOS headers leak. What did it cost? Everything...
* SubGhz: proper public api for protocols. Format Sources.
* Furi: slightly less redundant declarations
* Desktop: proper types in printf
* Sync API Symbols
* Furi: add timer reset and fix dolphin service, fix unit tests
* Furi: proper timer restart method naming and correct behavior in timer stopped state.
---------
Co-authored-by: hedger <hedger@nanode.su>
* Increase MF DESFire result buffer
* Ignore chunks that do not fit into the result buffer and show warning
* Display information about partial files
Co-authored-by: あく <alleteam@gmail.com>
* firmware: remove nfc lib build settings section
* furi hal nfc: fix nfc irq gpio deinit
* lib nfc: remove deprecated exception from sources
* nfc: use ASK demodulator in transparent mode
* mf ultralight: add upper page bound for NTAGI2C1K
* furi hal nfc: set event if nfc event was started
* nfc: fix PVS warnings
* lib signal reader: remove gpio pull setting in alloc
* furi: added math.h include for compatibility with existing apps
* nfc: remove resolved TODO in mf desfire poller
* bump api symbol version
Co-authored-by: hedger <hedger@nanode.su>
Co-authored-by: あく <alleteam@gmail.com>
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
* FuriHal: enable HSI in stop mode only if we use STOP0, proper SMPS selected clock assert
* Furi: fix double crash caused by bkpt use outside of debug session
* Libs: update ERC and MGG contrast
* Fix various crashes with LIB_DEBUG=1
* BadUsb: size_t where it should be and proper printf types
* Various fixes and make PVS happy
* FuriHal: proper CCID status and make PVS happy
* boot: update mode: graceful handling of corrupted stage file
---------
Co-authored-by: hedger <hedger@nanode.su>
* FuriHal: lower MGG display contrast by 4 points
* FuriHal: unify external gpio resources initialization
* Infrared: parse raw in universal TV file, cleanup it with new ifrared script. Other minor changes.
* Gui: fix elements_multiline_text_aligned eating symbols
* Lib: human readable errors in flipper application package
* Special request from marketing team
* Storage: count opened files
* Storage: sd mount
* Storage: prompt to mount SD card if not mounted
* F18: update API
* F18: update API version
* Fix logger naming scheme
* Storage: storage_files_count -> storage_open_files_count
Co-authored-by: あく <alleteam@gmail.com>
* added filename mode setting
* added furi_flag checks for when filename_mode is set
* changed naming for ibutton, lfrfid and subghz
* requested changes from PR
* Lib: gather all naming bits and pieces under name generator module. Properly bump api version. FuriHal: fix RTC flag enum.
* PR requested changes
* bug fix for arg type
* added functionality for other application scenes
* Lib: cleanup name generator API, simplify usage. Sync API symbols.
* Lib: proper size type in name_generator. Cleanup.
* FuriHal: cleanup rtc api usage across firmware
Co-authored-by: あく <alleteam@gmail.com>
* TODO FL-3497: impossible to fix with current memory allocator
* TODO FL-3497: removed, requires radically different settings approach
* TODO FL-3514: removed, yes we should
* TODO FL-3498: implemented, guarding view port access with mutex.
* TODO FL-3515: removed, questionable but ok
* TODO FL-3510: removed, comment added
* TODO FL-3500: refactored, store pin numbers in GpioPinRecord, fix gpio app crash caused by incorrect gpio_pins traversal.
* Format Sources
* TODO FL-3505: removed, mutex alone is not going to fix issue with WPAN architecture
* TODO FL-3506: removed, change ownership by copy is good
* TODO FL-3519: documentation and link to source added
* Lib: remove unneded total sum from comment in bq27220
---------
Co-authored-by: hedger <hedger@users.noreply.github.com>
* Allow loading user supplied keys and add CTR mode
* Add GCM mode to furi_hal_crypto
* Split up CTR and GCM code, add flag for adv crypto
* Add convenience functions for GCM crypto
* Run fbt format
* Update GCM to support additional auth data
* Update APIs
* FuriHal: update crypto documentation, method names and usage
* Clean up code for key (un)loading, GCM and CTR
- get rid of goto
- do not use furi_hal_bt_is_alive() when not using secure enclave
- give defines a type and wrap in ()
* Add unit test for CTR and GCM crypto
* FuriHal: const in crypto unit tests, cortex timer for crypto operations timeouts
* FuriHal: update crypto docs
Co-authored-by: twisted_pear <twstd@posteo.net>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
* Allow loading user supplied keys and add CTR mode
* Add GCM mode to furi_hal_crypto
* Split up CTR and GCM code, add flag for adv crypto
* Add convenience functions for GCM crypto
* Run fbt format
* Update GCM to support additional auth data
* Update APIs
* FuriHal: update crypto documentation, method names and usage
* Clean up code for key (un)loading, GCM and CTR
- get rid of goto
- do not use furi_hal_bt_is_alive() when not using secure enclave
- give defines a type and wrap in ()
* Add unit test for CTR and GCM crypto
* FuriHal: const in crypto unit tests, cortex timer for crypto operations timeouts
* FuriHal: update crypto docs
Co-authored-by: twisted_pear <twstd@posteo.net>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
* NFC CLI: Fix multiple apdu commands from not working when one of them gives an empty response
* Make PVS happy
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
* NFC: Fix key invalidation (again~)
* NFC: shouldn't be there
This code get called each time we check for B key
Co-authored-by: あく <alleteam@gmail.com>
still has problems, need to rewrite subghz_devices tx/rx switch code, checking strcmp every time is not good too, but better than loading whole config from microsd
* NFC: Improved MFC emulation on some readers
* NFC: Improved emulation on some readers (part 2): Some Android devices don't like this
* NFC: Improved emulation on some readers (part 3): I knew that during the emulation timings are critical, but one log breaks all...
* NFC: Improved emulation on some readers (part 4): Add fixes to Detect reader and refactor code
* NFC: Improved emulation on some readers (part 5)
* NFC: Improved emulation on some readers (part 6): GUI doesn't update without delay
* NFC: Improved emulation on some readers (part 7): Reworked emulation flow, some bug fixes and improvements
Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
* Lib: adjust default contrast for ERC displays
* Furi: various improvements in check module
* Format Sources
* FurHal: ble early hardfault detection
---------
Co-authored-by: hedger <hedger@users.noreply.github.com>
* Music player: move music_worker to library
* Music player: drop cli
* Debug: speaker debug app
* Debug: baudrate arg in uart_echo app
* Libs: add music_worker to api
* Libs: add music_worker to targets linker_dependencies
Co-authored-by: あく <alleteam@gmail.com>
* improve digital_signal for longer packets, also clean up code
* added SLIX2 specific features like signature and unknown keys (for issue #2781), added WRITE_PASSWORD handling
* fix NfcV AFI selection
* when NFCV_CMD_READ_MULTI_BLOCK reads beyond memory end, return the maximum possible block's content
* added SLIX2 reading
* fix NXP SYSTEMINFO response check size
* capture the first received password if none was set before
* clear stored data before reading SLIX details renamed slix2_dump functions to slix2_read
* display card block size values as decimal
Co-authored-by: あく <alleteam@gmail.com>
* I was outplayed by the C programming language
* Fix emulating empty keys as 0s
* Add exceptions for Detect Reader
* Sync api_symbols.csv for F18
* Outplayed by the C language [X2]
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
* added support for ISO15693 (NfcV) emulation, added support for reading SLIX tags
* SLIX: fixed crash situation when an invalid password was requested
* ISO15693: show emulate menu when opening file
* rename NfcV emulate scene to match other NfcV names
* optimize allocation size for signals
* ISO15693: further optimizations of allocation and free code
* ISO15693: reduce latency on state machine reset
* respond with block security status when option flag is set
* increased maximum memory size to match standard
added security status handling/load/save
added SELECT/QUIET handling
more fine grained allocation routines and checks
fix memset sizes
* added "Listen NfcV Reader" to sniff traffic from reader to card
* added correct description to delete menu
* also added DSFID/AFI handling and locking
* increase sniff log size
* scale NfcV frequency a bit, add echo mode, fix signal level at the end
* use symbolic modulated/unmodulated GPIO levels
* honor AFI field, decrease verbosity and removed debug code
* refactor defines for less namespace pollution by using NFCV_ prefixes
* correct an oversight that original cards return an generic error when addressing outside block range
* use inverse modulation, increasing readable range significantly
* rework and better document nfc chip initialization
* nfcv code review fixes
* Disable accidentally left on signal debug gpio output
* Improve NFCV Read/Info GUIs. Authored by @xMasterX, committed by @nvx
* Fix crash that occurs when you exit from NFCV emulation and start it again. Authored by @xMasterX, committed by @nvx
* Remove delay from emulation loop. This improves compatibility when the reader is Android.
* Lib: digital signal debug output pin info
Co-authored-by: Tiernan Messmer <tiernan.messmer@gmail.com>
Co-authored-by: MX <10697207+xMasterX@users.noreply.github.com>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* digital signal: add optimization
* nfc test: more restrict tests
* digital signal: build as separate library
* digital signal: remove unused flags, format sources
* digital signal: fix cflag name
* target: fix build for f18 target
Co-authored-by: あく <alleteam@gmail.com>
* fbt: added hooks for build & dist environments
* Moved env hooks to an optional file
* Fixed var name
* Added fw origin to device info
* Bumped device info version
* fbt: added FIRMWARE_ORIGIN option. Different implementation for FW_ORIGIN_* C macro.
* api: bumped versions
* fbt: added fbt_options_local.py
* gitignore: cleanup
Co-authored-by: あく <alleteam@gmail.com>
* FuriHal: add bus abstraction and port some subsystem to it
* Make PVS happy, cleanup code
* Update API symbols for f18
* F18: backport bus changes from f7
* Revert to STOP2 sleep mode
* Fix downgrading the firmware via updater
* Port iButton TIM1 to furi_hal_bus
* Port Infrared TIM1 and TIM2 to furi_hal_bus
* Just enable the timer bus
* Port furi_hal_pwm to bus API
* Fix include statement
* Port furi_hal_rfid to bus API
* Port furi_hal_subghz and others to bus API
* Remove unneeded include
* Improve furi_hal_infrared defines
* Reset LPTIM1 via furi_hal_bus API
* Crash when trying to enable an already enabled peripheral
* Better defines
* Improved checks
* Lots of macro wrappers
* Copy spi changes for f18
* Fix crashes in LFRFID system
* Fix crashes in NFC system
* Improve comments
* Create FuriHalBus.md
* Update FuriHalBus.md
* Fix crash when launching updater
* Documentation: couple small fixes in FuriHalBus
* FuriHal: fix copypaste in furi_hal_rfid_tim_reset
* FuriHal: reset radio core related peripherals on restart
* FuriHalBus: is enabled routine and bug fix for uart
* RFID HAL: accomodate furi hal bus
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
Co-authored-by: SG <who.just.the.doctor@gmail.com>
* Implement support for reading Opal card (Sydney, Australia)
* stub_parser_verify_read: used UNUSED macro
* furi_hal_rtc: expose calendaring as functions
* opal: use bit-packed struct to parse, rather than manually shifting about
* Update f18 api symbols
Co-authored-by: あく <alleteam@gmail.com>
* nfc: Add Mifare Ultralight C detection
* nfc: Add display name for MFUL C and hide menu items
MFUL C unlock and emulation currently not supported, so hide from menu
if current card is MFUL C
* nfc: Also check response when probing 3DES auth
* nfc: Hide emulate option in saved menu for MFUL if not supported
* nfc: Remove unlock options from saved menu if Ultralight C
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
Settings scene, char Validator, Idea -> by Willy-JL
Implemented by me
Kod plohoi, ochen plohoi, kto mozhet - sdelaite kak nado, esli smozhete :)
Ya luche varianta ne pridumal poka 4to
* added DigitalSequence to chain multiple DigitalSignals
added PulseReader for hardware assisted digital signal sampling
* added send_time option to start a signal at a specific DWT->CYCCNT value
* fixed linter errors and undone function renaming
* fixed renaming
* flagged functions in api_symbols.csv
* allow gpio field to stay uninitialized in digital_signal_prepare_arr()
* fix test cases to match (expected) implementation
* pulse_reader: build as static library
Signed-off-by: g3gg0.de <git@g3gg0.de>
* fix starting level detection in pulse_reader
* added unit test for pulse_reader
* change pulse reader test timings to 1, 10 and 100 ms
* fine tuned timings for pulse_reader test
* pulse_reader_stop now deinits GPIO as recommended by @gornekich
* ran format_py
* pulse_reader: remove from API, allow to link with faps
Signed-off-by: g3gg0.de <git@g3gg0.de>
* remove unit test for pulse_reader again
* pulse_reader: add call to set GPIO pull direction
* make structures private, add C implementation of digital_signal_update_dma()
* digital_signal/pulse_reader: allow parameters for free to be NULL
* digital_signal: show unoptimized and optimized code for digital_signal_update_dma() next to each other
* pulse_reader: further optimize assembly code
* digital_signal: reduce code complexity of digital_signal_update_dma() by only reconfiguring DMA2
* digital_signal: remove assembly code, limiting the performance but increasing portability
* added recovery if the timer already expired
* digital_signal: fix memory leak
* digital_signal: keep lock until all DMA transfers have finished
* DigitalSequence: fix issues with concatenation of same levels and spurious bit flips
* DigitalSignal: use cyclic DMA buffer for sequences
* update api_symbols.csv
* Update api_symbols.csv for f18 target
* Patches from @gornekich to fix linter warnings.
* Remove some redundant if checks
* Remove some magic numbers and reformat.
* Remove forced terminating edge.
Signed-off-by: g3gg0.de <git@g3gg0.de>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: Tiernan Messmer <tiernan.messmer@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
* SubGhz: add SubGhzThresholdRssi
* SubGhz: remove direct reading of subghz-txrx-txrx_state
* SubGhz: remove direct reading subghz->txrx->hopper_state
* SubGhz: remove direct reading subghz->lock
* SubGhz: check load type file
* SubGhz: remove direct reading subghz->txrx->rx_key_state
* SubGhz: remove direct reading subghz->txrx->speaker_state
* SubGhz: refactoring subghz_scene_set_type.c
* SubGhz: moving "txrx" entity to a separate file
* SubGhz: show error tx start
* SubGhz: refactoring RPC
* SubGhz: value get optimizations
* SubGhz: fix name file
* SubGhz: add function description
* SubGhz: fix double back with a blocked transmission in this region and speacker, when a transmission is blocked in this region
* SubGhz: correct spelling
* SubGhz: better naming
* SubGhz: simplify includes
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
* cubewb: downgraded to v1.15.0
* hal: updated f18 symbols to match LL
* hal: flash: use furi_hal_cortex_timer for timeouts
* scripts: fixed cube version validation from config file
* hal: flash: added 3 seconds timeout when waiting for C2 to unlock flash controller. On timeout, triggers furi_check
* nfc: fixed missing interrupt setup on multiple platformSetIrqCallback() invocations
* hal: gpio: don't trigger furi_check on furi_hal_gpio_add_int_callback() with same parameters
* Reverted NFC fixes - will be in a separate PR
* scripts: storage: fixed exception handler for paths
* Furi: more gpio checks in HAL
* Nfc: do not spawn service thread if it is already spawned
Co-authored-by: Sergey Gavrilov <who.just.the.doctor@gmail.com>
* Separate ibutton to its own module, add one_wire to f18
* Move onewire cli to a separate app
* Add definitions for normal and overdrive timings
* Update api definitions
* Add rough overdrive timings definition for onewire emulation
* Remove one_wire_host_timing.h
* Add rough overdrive timings for onewire host
* Improve overdrive mode
* Working overdrive mode from flipper to flipper
* Update thermometer example app
* Turn on otg power when running thermometer example app
* Implement reset overdrive switching
* Always exit out of overdrive mode
* Improve overdrive timings
* Fix typos
* Fix reset behaviour
* Use overdrive mode everywhere in DS1996
* Improve comments
* Bump API version
Co-authored-by: あく <alleteam@gmail.com>
When we using 433.92 remote flipper in hopping mode will stuck at 433.42 and may loose signal because of that, need to avoid using close freqs in hopping, only freqs with bigger difference like 310 -> 315
* debug: automated support for multiple debug symbol files
* faploader: extra checks for app list state
* debug: trigger BP before fap's EP if under debugger
* faploader, debug: better naming
* docs: info on load breakpoint
* faploader: header cleanup
* faploader: naming fixes
* debug: less verbose; setting debug flag more often
* typo fix
* iButton: Add DS1971 Support refactored for v2
* Fix requested by gsurkov
* Fix DALLAS_COMMON_CMD_* use, cusotm data field to Eeprom and COPY_SCRAPTCHPAD
* Fix Emulation + Memory Info + Docs
* Fix docs, strings, refactor code
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
* NFC: Support reading Mifare Classic key B from sector trailer and reusing it for other sectors
* NFC: Fix my pointer typo
* NFC: Fix reading sector with B key where A key can't read block (fixes#2413) and fix Nfc Magic app not using NFC folder by default (in file select)
* NFC: Fix strange bug
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>