libusb
libusb copied to clipboard
Cannot pass variables to `ControlTransfer` because type is not exported
The libusb.DeviceHandle::ControlTransfer methods arg[0] has a non-exported type bmRequestType. As a result it seems like this method can only be called with hard-coded values and not passed in with a variable of type byte.
Example of what I have to write:
bytes_sent, err := handle.ControlTransfer(
(0x01<<5)+0x01,
0x09,
reportId+(0x03<<8),
0,
msg,
len(msg),
5000)
Example of what I would like to write:
requestClass := byte(0)
interfaceIndex := byte(32)
endpointOutIndex := byte(1)
bytes_sent, err := handle.ControlTransfer(
requestClass | interfaceIndex | endpointOutIndex,
0x09,
reportId+(0x03<<8),
0,
msg,
len(msg),
5000)