Add API to enforce ISO15693 mode
What's new
- Adds a new API to the NFC parser to allow applications to enforce a specific parsing mode. Some apps, such as Picopass, will always use one of the modes, so disabling autodetection can help to prevent issues resulting from incorrectly autodetecting the state (i.e. due to noise). It also includes a way to re-enable autodetection, should that be useful in the future.
Verification
- Build a modified version of the Picopass app which calls the new
nfc_iso15693_force_1outof4method and emulate a card. Scanning the card on the reader no longer causes the Flipper to crash when the reader has LF enabled.
Checklist (For Reviewer)
- [ ] PR has description of feature/bug or link to Confluence/Jira task
- [ ] Description contains actions to verify feature/bugfix
- [ ] I've built this code, uploaded it to the device and verified feature/bugfix
A bit of background, picopass only ever uses 1of4 modulation not 1of256. As readers will never use 1of256 if noise ever makes it appear like a 1of256 SOF was sent it will hang there indefinitely as the reader will never send a 1of256 EOF causing https://github.com/flipperdevices/flipperzero-firmware/issues/3343
It is probably worth also having a timeout (we know the maximum frame size, if we don't see the rest of the frame in this time we should reset the emulation state ready for the next frame) and fix what looks like a buffer overrun in the 1of256 code (https://github.com/flipperdevices/flipperzero-good-faps/issues/105), but even with those two things fixed I still think it makes sense allowing emulation code to opt out of 1of256 when it's known it should never happen as accidentally interpreting something as the 1of256 SOF would still likely interrupt emulation until the timeout occurs which would almost certainly cause the reader to time out.
A quick look at the patch seems fine to me, but I'm not an expert on the HAL design.
This should be an easier one to review since it is just adding a new API and not changing how anything functions
Fixed in https://github.com/flipperdevices/flipperzero-firmware/pull/3988
Fixed in #3988
While this fixed the crash bug in the picopass code, there are certain cards based on 15693 (eg, picopass) that does does not support the 1of256 mode so technically without this functionality it would always be possible to detect emulation vs a real card if the reader tested if the card responds to 1of256 mode.