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 partial usbtmc reads and request the size amount of bytes from the device #470

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jimmyvandenbergh
Copy link
Contributor

another update for reading the data back from the device. this enhances the PR #465

changes explained below:

  • req = BulkInMessage.build_array(self._btag, size, None) we want to request the amount of bytes from the device which user specifies. therefore the header may specify more bytes then in a single transaction wMaxPacketSize can be transmitted. the device may response with less bytes.
  • above is also needed when you want to support IEEE 488.2 arbitrary block reads. this normally will read 2 bytes # then your read the number of bytes from the device which holds the exact amount of bytes the data packega may hold. this to claim memory on the host for large data packets. see below image:

image

  • resp = raw_read(self.usb_recv_ep.wMaxPacketSize) you may request wMaxPacketSize but the device may send less bytes than requested

  • fix the indentation of the received_message.extend(received_transfer[: response.transfer_size]) this should always remove the alignment bytes instead of only on EOM

  • Closes # (insert issue number if relevant)

  • Executed black . && isort -c . && flake8 with no errors

  • The change is fully covered by automated unit tests

  • Documented in docs/ as appropriate

  • Added an entry to the CHANGES file

…t IEEE 488.2 arbitrary block reads fixes the requested data to be send in the header instead of recv_chunk.
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 24.48%. Comparing base (4a77dd0) to head (7fc0e7e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pyvisa_py/protocols/usbtmc.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #470      +/-   ##
==========================================
+ Coverage   24.46%   24.48%   +0.02%     
==========================================
  Files          23       23              
  Lines        3487     3484       -3     
  Branches      398      398              
==========================================
  Hits          853      853              
+ Misses       2629     2626       -3     
  Partials        5        5              
Flag Coverage Δ
unittests 24.48% <0.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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