gotmc/mccdaq

Error when reading number of bytes that isn't multiple of max packet size (64 bytes)

matthewrankin opened this issue · 1 comments

When totalScans in the usb1608fsplus/example.go is set to something other than a multiple of the max packet size for bulk transfers (64 bytes for the USB-1608FS-Plus), an overflow error is returned. Not sure if this is a problem with the libusb Go driver, the example code, or mccdaq.

It appears when in continuous scan mode (i.e., whenever numScans in StartScan(numScans int) is set to 0), the data must be read in multiples of 64 bytes otherwise a USB bulk transfer overflow error is generated (LIBUSB_ERROR_OVERFLOW = -8). I've added a guard to ReadScan(numScans int) so that numScans must be a multiple of maxBulkTransferPacketSize, which is 64 bytes for the MCC USB-1608FS-Plus.