hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

hid_write: number of bytes written does not match report size?

Open pdged opened this issue 7 years ago • 2 comments
trafficstars

I have an output report of 64 bytes, and it is using report ids. The number of bytes written is always 64, and not 65. Is this correct ?

const uint8_t report_id = 1;
const int report_size = 64;
const int buf_size = report_size + 1; // for the report id
uint8_t buf[buf_size];
buf[0]=report_id;
auto num_bytes_written = hid_write(device, buf, buf_size);
if (num_bytes_written != buf_size) {
// error
}

pdged avatar Nov 28 '17 14:11 pdged

Which OS are you on?
I believe this is a problem currently with Windows hid_write(). See issue #356 and #255.

todbot avatar Jan 01 '18 21:01 todbot

Make sure to remove the driver if on windows, Windows cashes the descriptor. If you make changes to a size, you must remove it and let it reinstall.

ulao avatar Jan 31 '18 15:01 ulao