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

Support reads of binary data #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

simmonmt
Copy link

I wanted to make screenshots work for my Keysight scope, and decided to focus solely on the usbtmc layer. I made some changes to enable screenshots. This PR could easily be split into multiple commits, but I wanted to get a sniff test before going to all that effort. Please take a look and let me know what you think? Below is a rough list of the changes in the PR.

  • The existing code always turned on termChar, which results in problems when binary data is read since binary data may innocently contain termChar (defaulted to '\n'). A new method BulkRead unconditionally disables termChar.
  • Added debugging information conditioned on an environment variable. Print sent and received headers.
  • Allow the starting tag number to be overridden in the context. This may or may not be a useful change.
  • Don't hard-code the initial buffer size. Read as much as the client wants to read, and then some.

The existing code always turned on termChar, which results in problems
when binary data is read since binary data may innocently contain
termChar (defaulted to '\n'). A new method BulkRead unconditionally
disables termChar.

Added debugging information conditioned on an environment variable.
Print sent and received headers.

Allow the starting tag number to be overridden in the context. This may
or may not be a useful change.

Don't hard-code the initial buffer size. Read as much as the client
wants to read, and then some.
If a short read, return the number of bytes read. If a complete read, return
the transfer size, which may be smaller than the number of bytes read.
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.

1 participant