4 #if (_MSC_FULL_VER < 180031101) 5 #error At least Visual Studio 2013 Update 4 is required to compile this backend 27 #pragma comment(lib, "winusb.lib") 35 USB_DEVICE_DESCRIPTOR desc;
36 ULONG return_length = 0;
37 if (!WinUsb_GetDescriptor(handle, USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, (PUCHAR)&desc,
sizeof(desc), &return_length))
39 throw winapi_error(
"WinUsb action failed, last error: " + GetLastError());
46 USB_CONFIGURATION_DESCRIPTOR desc;
47 ULONG return_length = 0;
48 if (!WinUsb_GetDescriptor(handle, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0, (PUCHAR)&desc,
sizeof(desc), &return_length))
50 throw winapi_error(
"WinUsb action failed, last error: " + GetLastError());
53 std::vector<uint8_t> rv(desc.wTotalLength);
56 if (!WinUsb_GetDescriptor(handle, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0, rv.data(), desc.wTotalLength, &return_length))
58 throw winapi_error(
"WinUsb action failed, last error: " + GetLastError());
71 for (
int i = 0;
i < descriptors.size(); )
73 auto l = descriptors[
i];
74 auto dt = descriptors[
i + 1];
76 memcpy(ud.
data.data(), &descriptors[
i], l);
84 std::vector<std::shared_ptr<usb_interface>> rv;
86 auto sts = handle.
open(path);
88 throw winapi_error(
"WinUsb action failed, " + GetLastError());
95 auto d = descriptors.at(
i.first);
96 auto intf = std::make_shared<usb_interface_winusb>(
i.second,
d,
path);
109 for (
auto&& device_path : devices_path)
119 [interface_number](
const rs_usb_interface&
i) {
return interface_number ==
i->get_number(); });
131 auto dh = std::make_shared<handle_winusb>();
132 auto sts = dh->open(intf->get_device_path());
135 return std::make_shared<usb_messenger_winusb>(shared_from_this(), dh);
GLuint64 GLenum void * handle
GLsizei const GLchar *const * path
def info(name, value, persistent=False)