From b1b9b60626211fb36aac525109f07d30aa10627d Mon Sep 17 00:00:00 2001 From: kalman Date: Mon, 7 May 2018 15:03:52 +0800 Subject: [PATCH] add uvc extension unit guid --- src/internal/channels.cc | 4 +++- src/uvc/uvc-wmf.cc | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/internal/channels.cc b/src/internal/channels.cc index 51e8f74..2bdecd0 100644 --- a/src/internal/channels.cc +++ b/src/internal/channels.cc @@ -15,6 +15,8 @@ MYNTEYE_BEGIN_NAMESPACE namespace { +const uvc::xu mynteye_xu = {3, 1, {0x18682d34, 0xdd2c, 0x4073, {0xad, 0x23, 0x72, 0x14, 0x73, 0x9a, 0x07, 0x4c}}}; + int XuCamCtrlId(Option option) { switch (option) { case Option::EXPOSURE_MODE: @@ -838,7 +840,7 @@ bool Channels::PuControlQuery( bool Channels::XuControlQuery( channel_t channel, uvc::xu_query query, uint16_t size, uint8_t *data) const { - return XuControlQuery({3}, channel >> 8, query, size, data); + return XuControlQuery(mynteye_xu, channel >> 8, query, size, data); } bool Channels::XuControlQuery( diff --git a/src/uvc/uvc-wmf.cc b/src/uvc/uvc-wmf.cc index e622709..8061ae7 100644 --- a/src/uvc/uvc-wmf.cc +++ b/src/uvc/uvc-wmf.cc @@ -139,7 +139,7 @@ static std::string win_to_utf(const WCHAR * s) static void check(const char *call, HRESULT hr) { if (FAILED(hr)) { - throw_error() << call << "(...) returned 0x" << std::hex << (uint32_t)hr; + throw_error() << call << "(...) returned 0x" << std::hex << (uint32_t)hr; } } @@ -278,7 +278,7 @@ public: struct device { const std::shared_ptr parent; int vid, pid; - const std::string unique_id; + std::string unique_id; std::string name; com_ptr reader_callback; @@ -551,14 +551,14 @@ bool pu_control_query( return false; } } - +/* void get_extension_control_range(const device &device, const xu &xu, uint8_t selector, xu_query query, uint8_t *data) { CHECK_NOTNULL(data); int offset = 0; auto ks_control = const_cast(device).get_ks_control(xu); - /* get step, min and max values*/ + // get step, min and max values KSP_NODE node; memset(&node, 0, sizeof(KSP_NODE)); node.Property.Set = reinterpret_cast(xu.id); @@ -610,7 +610,7 @@ void get_extension_control_range(const device &device, const xu &xu, uint8_t sel * data = (uint8_t)*(pRangeValues + offset); } - +*/ bool xu_control_query( const device &device, const xu &xu, uint8_t selector, xu_query query, uint16_t size, uint8_t *data) @@ -634,10 +634,16 @@ bool xu_control_query( node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY; break; case XU_QUERY_MIN: + offset = 1; + node.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_TOPOLOGY; + break; case XU_QUERY_MAX: + offset = 2; + node.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_TOPOLOGY; + break; case XU_QUERY_DEF: - get_extension_control_range(device, xu, selector, query, data); - return true; + node.Property.Flags = KSPROPERTY_TYPE_DEFAULTVALUES | KSPROPERTY_TYPE_TOPOLOGY; + break; default: return false; }