16 _info(info), _device_path(device_path)
18 USB_CONFIGURATION_DESCRIPTOR cfgDesc;
19 ULONG returnLength = 0;
20 if (!WinUsb_GetDescriptor(handle, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0, (PUCHAR)&cfgDesc,
sizeof(cfgDesc), &returnLength))
22 throw winapi_error(
"WinUsb action failed, last error: " + GetLastError());
25 std::vector<uint8_t>
config(cfgDesc.wTotalLength);
28 if (!WinUsb_GetDescriptor(handle, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0, config.data(), cfgDesc.wTotalLength, &returnLength))
30 throw winapi_error(
"WinUsb action failed, last error: " + GetLastError());
33 for (
int i = 0;
i < info.bNumEndpoints;
i++) {
34 WINUSB_PIPE_INFORMATION pipeInformation;
35 if (!WinUsb_QueryPipe(handle, info.bAlternateSetting,
i, &pipeInformation)) {
36 auto error = GetLastError();
37 if (
error != ERROR_NO_MORE_ITEMS)
41 _endpoints.push_back(std::make_shared<usb_endpoint_winusb>(pipeInformation, info.bInterfaceNumber));
49 if (ep->get_type() !=
type)
GLuint64 GLenum void * handle
def info(name, value, persistent=False)