13 #define USB_SUBCLASS_CONTROL 1 16 {
"UVC_RC_UNDEFINED", 0x00},
17 {
"UVC_SET_CUR", 0x01},
18 {
"UVC_GET_CUR", 0x81},
19 {
"UVC_GET_MIN", 0x82},
20 {
"UVC_GET_MAX", 0x83},
21 {
"UVC_GET_RES", 0x84},
22 {
"UVC_GET_LEN", 0x85},
23 {
"UVC_GET_INFO", 0x86},
24 {
"UVC_GET_DEF", 0x87},
25 {
"UVC_REQ_TYPE_GET", 0xa1},
26 {
"UVC_REQ_TYPE_SET", 0x21}
33 return p.second == req;
41 {
"PU_CONTROL_UNDEFINED", 0x00},
42 {
"PU_BACKLIGHT_COMPENSATION_CONTROL", 0x01},
43 {
"PU_BRIGHTNESS_CONTROL", 0x02},
44 {
"PU_CONTRAST_CONTROL", 0x03 },
45 {
"PU_GAIN_CONTROL", 0x04 },
46 {
"PU_POWER_LINE_FREQUENCY_CONTROL", 0x05 },
47 {
"PU_HUE_CONTROL", 0x06 },
48 {
"PU_SATURATION_CONTROL", 0x07 },
49 {
"PU_SHARPNESS_CONTROL", 0x08 },
50 {
"PU_GAMMA_CONTROL", 0x09 },
51 {
"PU_WHITE_BALANCE_TEMPERATURE_CONTROL", 0x0A },
52 {
"PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL", 0x0B },
53 {
"PU_WHITE_BALANCE_COMPONENT_CONTROL", 0x0C },
54 {
"PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL", 0x0D },
55 {
"PU_DIGITAL_MULTIPLIER_CONTROL", 0x0E },
56 {
"PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL", 0x0F },
57 {
"PU_HUE_AUTO_CONTROL", 0x10 },
58 {
"PU_ANALOG_VIDEO_STANDARD_CONTROL", 0x11 },
59 {
"PU_ANALOG_LOCK_STATUS_CONTROL", 0x12 },
60 {
"PU_CONTRAST_AUTO_CONTROL", 0x13 },
66 std::vector<usb_device_info> rv;
70 if (std::find_if(rv.begin(), rv.end(), [&](
const usb_device_info&
i) {
return i.id ==
info.id; }) == rv.end())
83 printf(
"\n1 USB device found:\n\n");
87 int device_counter = 0;
90 printf(
"%d)uid: %s\tmi: %d\tpath: %s\n", ++device_counter, device_info.unique_id.c_str(), device_info.mi, device_info.id.c_str());
92 printf(
"===============================================================================\n");
95 TEST_CASE(
"first_endpoints_direction",
"[live][usb]")
98 int device_counter = 0;
101 if(
info.vid != 0x8086)
106 auto interfaces =
dev->get_interfaces();
107 auto it = std::find_if(interfaces.begin(), interfaces.end(),
127 const int REQ_TYPE_GET = 0xa1;
129 std::vector<int> requests =
137 bool controls_found =
false;
141 if(
info.vid != 0x8086)
150 std::vector<rs_usb_interface> interfaces =
dev->get_interfaces();
151 REQUIRE(interfaces.size() > 0);
154 std::map<int,int> processing_units =
163 for (
auto&& intf : interfaces)
168 controls_found =
true;
169 if (processing_units.find(intf->get_number()) == processing_units.end())
172 auto unit = processing_units.at(intf->get_number());
174 printf(
"interface: %d, processing unit: %d\n", intf->get_number(),
unit);
175 int index =
unit << 8 | intf->get_number();
180 int value = ctrl.second << 8;
182 for(
auto&& req : requests)
186 auto sts =
m->control_transfer(REQ_TYPE_GET, req, value, index, reinterpret_cast<uint8_t*>(&val),
sizeof(val), transferred, timeout);
189 REQUIRE(transferred ==
sizeof(val));
193 if(values.size() > 0)
194 printf(
"%s:\n", ctrl.first.c_str());
196 for(
auto&& req : values)
198 printf(
"%s:\t%d\t",
req_to_string(req.first).c_str(), req.second);
201 if(values.size() > 0)
207 printf(
"There are no control interfaces available, force winusb to probe controls\n");
208 printf(
"===============================================================================\n");
215 std::vector<uint8_t> rv(header_size + data_size);
221 memcpy(rv.data(), &data_size,
sizeof(
uint16_t));
232 bool is_sr300 = ((dev->get_info().pid == 0x0AA5) || (dev->get_info().pid == 0x0B48)) ?
true :
false;
235 bool require_response =
true;
247 <<
"." <<
static_cast<int>(fws[1]) <<
"." << static_cast<int>(fws[0]);
249 printf(
"device: %s, fw: %s\n", dev->get_info().unique_id.c_str(), fw.c_str());
256 int device_counter = 0;
258 printf(
"Devices FW version:\n");
262 if(
info.vid != 0x8086)
267 for(
int i = 0;
i < 3;
i++)
270 printf(
"===============================================================================\n");
278 auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(
end -
begin).
count();
280 printf(
"===============================================================================\n");
286 int device_counter = 0;
289 if (
info.vid != 0x8086)
294 auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(
end -
begin).
count();
299 printf(
"===============================================================================\n");
std::string req_to_string(int req)
#define USB_SUBCLASS_CONTROL
void read_gvd(const rs_usb_device &dev)
std::vector< std::shared_ptr< device_info > > devices_info
std::vector< usb_device_info > get_devices_info()
GLdouble GLdouble GLdouble w
GLsizei const GLchar *const * string
def info(name, value, persistent=False)
TEST_CASE("query_devices","[live][usb]")
const uint16_t IVCAM_MONITOR_MAGIC_NUMBER
const base::type::char_t * unit
Exposes sensor options functionality for C compilers.
GLsizei const GLfloat * values
GLbitfield GLuint64 timeout
std::vector< uint8_t > create_gvd_request_buffer(bool is_sr300)
void copy(void *dst, void const *src, size_t size)
std::string to_string(T value)