Skip to content
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

Add special bbio mode for hydranfc #120

Closed
wants to merge 0 commits into from
Closed

Conversation

gvinet
Copy link
Contributor

@gvinet gvinet commented May 23, 2020

No description provided.

Copy link
Collaborator

@Baldanos Baldanos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi !
Thanks for your submission, this looks really promising !

I made several comments in order to improve this mode. That way, it would be more like other Hydrabus modes.

Let me know if you need clarification or help on this.

src/hydrabus/hydrabus_bbio.h Outdated Show resolved Hide resolved
src/hydranfc/hydranfc_bbio_reader.c Outdated Show resolved Hide resolved
chnRead(con->sdu, &c, 1);

if (c == 0) {
cprint(con, "BBIO2", 5);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BBIOx string is already handled in hydrabus_bbio.c, this can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

src/hydranfc/hydranfc_bbio_reader.c Outdated Show resolved Hide resolved
src/hydranfc/hydranfc_bbio_reader.h Outdated Show resolved Hide resolved

while (!hydrabus_ubtn()) {

get_cmd(con, &bbio_subcommand, &length, rx_data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong, but this approach looks too cumbersome. For instance it needs 6 bytes to use the RF_OFF where only one byte could be enough.
Have a look at the bbio_mode_smartcard() in hydrabus_bbio_smartcard.c for an example implementation requiring additional bytes only when needed.

/*
* HydraBus/HydraNFC
*
* Copyright (C) 2018 Nicolas OBERLI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to change this

Comment on lines 123 to 127
cprint(con, (char *) &tag, 2);
cprint(con, (char *) &length, 4);
if (length > 0) {
cprint(con, (char *) data, length);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not send user-supplied data back, but only command status and/or data read from the protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants