-
Notifications
You must be signed in to change notification settings - Fork 19
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
WIP add Request::initialize_as_target #9
base: master
Are you sure you want to change the base?
Conversation
pub enum TargetMode { | ||
// TODO is this a valid mode? | ||
/// Accept all target modes | ||
Any = 0b000, |
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.
Is setting Mode to 0b000 valid?
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.
I think yes: there is no SyntaxError, and chip responds when I bring android phone to pn532 when target_mode is TargetMode::Any
pub struct TargetMifareParams { | ||
/// 2 bytes LSB first, as defined in ISO/IEC14443-3 | ||
pub sens_res: [u8; 2], | ||
/// has a fixed length of 3 bytes containing the nfcid11 to nfcid13 bytes. | ||
/// Indeed, the PN532 can handle only nfcid1t in single size | ||
pub nfcid1t: [u8; 3], | ||
pub sel_res: TargetSelRes, |
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.
Are there some default values that make sense here?
pub struct TargetFelicaParams { | ||
pub fncid2t: [u8; 8], | ||
pub pad: [u8; 8], | ||
/// These two bytes are returned in the POL_RES frame | ||
/// if the 4th byte of the incoming POL_REQ command frame is 0x01. | ||
pub system_code: [u8; 2], |
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.
Are there some default values that make sense here?
0, // no general bytes | ||
0, // no historical bytes |
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.
is it ok to skip general bytes and historical bytes here?
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.
If lib will just skip this in TgInitAsTarget command, there will be no way to set these later, because lib will wait chip's response, so you can't send TgSetGeneralBytes command just after TgInitAsTarget
What I can say about default values: with everything set to [0; N], TargetMode::PassiveOnly and TargetSelRes::PICC, my Android phone detects FeliCa: When I set params to some random recommendations from stackoverflow, NFC Tools can't see pn532, but it responses to microcontroller. (so there is a connection, but chip is not recognized by phone). Also I don't know how to emulate ISO 14443-3A (but I want to do it). |
Just thought I'd let you know. I'm rather limited on time currently so it might take me some weeks to properly finish this. (btw, I spent like 4 hours today on esp-rs/esp-hal#295 (comment) which you also seem to have encountered 🤣) |
I took a stab at adding a
initialize_as_target
Request
builder.I'm afraid I currently don't know enough about this kind of functionality so I'll leave some questions here.
@averyanalex maybe you could shed some light on them?