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

Writing of badge data via USB on Windows fails after 65 bytes #25

Open
hlxid opened this issue Aug 5, 2024 · 1 comment
Open

Writing of badge data via USB on Windows fails after 65 bytes #25

hlxid opened this issue Aug 5, 2024 · 1 comment

Comments

@hlxid
Copy link
Contributor

hlxid commented Aug 5, 2024

Detection of badges connected via USB works under Windows but writing a message to the connected badge fails with the following error message from the CLI:

Error: incomplete write: 65 of 384 bytes

The total byte count depends on the size of the message but the written byte count is always 65.

@mgjm
Copy link
Collaborator

mgjm commented Aug 6, 2024

The device.write call seems to behave different on Windows (compared to Linux / MacOS).

Two ideas:

  1. The API wants an "ReportID" as the first byte (as a prefix to the actual payload). But this ID is optional on Linux / MacOS.
    Fix: Prepend a 0x00 byte to the payload.
  2. If that does not help. The write might be incomplete like a regular write to a file and we need to write the remaining bytes until all bytes are written (like write_all in std::io::Write). With or without the 0x00 prefix.

I would guess that the report id is missing and the write fails after the first packet (64 bytes + 1 byte report id).

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

No branches or pull requests

2 participants