hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

Converting to HANDLE from hid_device

Open NefariousTechSupport opened this issue 4 years ago • 1 comments

Is there any way to convert from type hid_device to type HANDLE, I'm having issues with with hid_write() so have decided to use HidD_SetOutputReport(), which requests a variable of type HANDLE, which hid_device is incompatible with. I'm just wondering if there is a way to convert from hid_device to HANDLE.

void Write(hid_device* handle, unsigned char buf[0x21])  //handle is assigned in main(), yes it is done properly, you can read data however it isn't useful unless it is polled due to the devices protocol
{
	if (HidD_SetOutputReport(handle, buf, 0x21))             //Returns with false
	{
		cout << "write succeeded";
	}
	else
	{
		cout << "failed with code: " << GetLastError();    //Returns "failed with code: 6" which means invalid handle.
	}
}

Thanks in advance!

PS: if my tone seems annoyed, I'm just tired, so pardon that.

NefariousTechSupport avatar Oct 23 '20 22:10 NefariousTechSupport

Please see #373

Youw avatar Oct 23 '20 22:10 Youw