usbtmc
usbtmc copied to clipboard
Support reads of binary data
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.