]> sigrok.org Git - libsigrok.git/commit - src/hardware/hantek-6xxx/api.c
hantek-6xxx: Fix some issues by using power-of-two data sizes.
authorUwe Hermann <redacted>
Sun, 14 Aug 2016 21:51:49 +0000 (23:51 +0200)
committerUwe Hermann <redacted>
Sun, 14 Aug 2016 22:58:10 +0000 (00:58 +0200)
commitaf7f88242eef2bdcbaa7ff2d58f74ad616305b48
tree71d236b56d88483b27c61552be3324386e18da42
parent236303160c955ee58f08d00739b16da37386e6cc
hantek-6xxx: Fix some issues by using power-of-two data sizes.

There were issues when using non-power-of-two data sizes with e.g.
the Hantek 6022BE device. For example, on Windows the acquisition would
simply hang and never complete:

  hantek-6xxx: receive_transfer(): status LIBUSB_TRANSFER_ERROR received 0 bytes

The issue was reported by Erik Montnemery on the mailing list, the
original patch was posted by "mmark" here (thanks!):

  http://www.eevblog.com/forum/testgear/sainsmart-dds120-usb-oscilloscope-(buudai-bm102)/msg911729/#msg911729

The issue has been verified by me on Windows and Linux, and also that
this change does indeed fix it (tested Hantek 6022BE and Sainsmart DDS120).

Neither PulseView nor sigrok-cli hang anymore on Windows, and on Linux
the log messages suggest improvements as well:

  -hantek-6xxx: data_amount 712
  +hantek-6xxx: data_amount: 200 (rounded to power of 2: 512)

  -hantek-6xxx: receive_transfer(): calculated samplerate == 2327ks/s
  -hantek-6xxx: receive_transfer(): status LIBUSB_TRANSFER_OVERFLOW received 512 bytes.
  +hantek-6xxx: receive_transfer(): calculated samplerate == 1969ks/s
  +hantek-6xxx: receive_transfer(): status LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED received 512 bytes.

This fixes bug #821.
src/hardware/hantek-6xxx/api.c