I am running the program below which returns an error code(-1, LIBUSB_ERROR_IO, Bytes sent: 0) when trying to transfer the data. I am using the libusb-1.0 dll.
#include <stdio.h>
#include "inc/libusb.h"
int main(void) {
libusb_device_handle *dev_handle;
unsigned char buf[5] = {0x04, 0x00, 0x06, 0x06, 0x00};
int r, bytes_sent = 0;
if(libusb_init(NULL)) return 1;
dev_handle = libusb_open_device_with_vid_pid(NULL, 0x1b1c, 0x0c04);
libusb_claim_interface(dev_handle, 0);
r = libusb_interrupt_transfer(dev_handle, 0x81, buf, 5, &bytes_sent, 0);
printf("Return code: %d\nBytes sent: %d\n", r, bytes_sent);
libusb_release_interface(dev_handle, 0);
libusb_close(dev_handle);
libusb_exit(NULL);
return 0;
}
Also, I am not sure that I am using the correct endpoint address. These are some images from usbview: https://i.stack.imgur.com/rk2CX.png, https://i.stack.imgur.com/CK8n3.png. The first one shows the device I am trying to communicate with. Since not much information is provided from the device in the first image I use the information from the second image. I am right in assuming I need to use interrupt communication with this device, judging from the transfer type, under the endpoint descriptor?
Finally, is it possible that libusb might not be right for communicating with the specific device and I need to use another library?(eg. hidapi)