-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NFC MBTA CharlieCard parsing plugin #62
Conversation
to respond in order:
thank you! |
@@ -833,6 +863,9 @@ static uint16_t type_parse(const MfClassicData* data) { | |||
// bitshift (2bytes = 16 bits) by 6bits for just first 10bits | |||
const uint16_t type1 = pos_to_num(data, 2, 1, 0, 2) >> 6; | |||
const uint16_t type2 = pos_to_num(data, 3, 1, 0, 2) >> 6; | |||
// might be wise to remove the assertion; then again, it's an effective way | |||
// to crowdsource research, as hopefully if this isn't universally true, | |||
// someone will come running when their app crashes — probably not a best practice though haha. | |||
furi_assert(type1 == type2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
furi_assert() is compiled only when DEBUG=1 is enabled, which it is not by default, nor for production builds in Momentum, you'd need to compile with ./fbt <command> DEBUG=1
, so assert should be fine here! if you want to enforce it in all builds, regardless of DEBUG flag, you can use furi_check()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know! For my own education: does that mean compiling without DEBUG strips that, and is independent of the debug setting on the flipper? Or is the check kept in the compiled fap regardless, and the DEBUG compile arg simply sets the debug mode flag (locally or globally) on the flipper after flashing/launching?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEBUG=1
refers to the compiler options, with DEBUG=0
(default) furi_assert()
will be stripped completely. the Debug
option in flipper settings allows to attacha live debugger, and to access some extra hidden functionality (raw reads, debug info in some parsers...), but will not bring back the stripped furi_assert()
calls
Thanks Leptopt1los!
I asked @Leptopt1los from unleashed team about card verification, he said it looks great! The only thing he advised is maybe not only checking key A but also the paired key B in parse(), just to be safe. If you want to ge ahead with that, by all means do, otherwise we can merge as is :D |
Key B check added! Should be all set now. Time permitting, I'll also likely be slowly digging into the few remaining unknowns on the card over the coming weeks; is there a preferred PR / contributing etiquette here? (ie, only PR at "project end" to minimize the number of PRs to review? PR with each individual discovery / improvement to keep things bleeding-edge? other?) Thanks again for y'all's input & help! |
perfect, thank you! yes, feel free to make new PRs as you progress with the parser. as for timing, whatever works best for you, as long as its not like once per day xD |
What's new
Built NFC plugin for MBTA CharlieCard (Boston, MA, USA)
read
,verify
, andparse
I'm not particularly adept with C, nor experienced in contributing to open-source projects, so feedback / review of the following sought, in decreasing order of importance:
read
andverify
functions are largely taken as boilerplate from analogous plugins, as are the initial checks at the start of theparse
function.Credit & citations listed in header comment.
For the reviewer