change the way to get xu control's range

This commit is contained in:
kalman
2018-05-31 15:09:00 +08:00
parent 87470f29a9
commit 5be47846e7
6 changed files with 43 additions and 18 deletions

View File

@@ -838,15 +838,15 @@ bool Channels::PuControlQuery(
}
bool Channels::XuControlRange(
channel_t channel, int32_t *min, int32_t *max, int32_t *def) const {
return XuControlRange(mynteye_xu, channel, min, max, def);
channel_t channel, uint8_t id, int32_t *min, int32_t *max, int32_t *def) const {
return XuControlRange(mynteye_xu, channel, id, min, max, def);
}
bool Channels::XuControlRange(
const uvc::xu &xu, uint8_t selector, int32_t *min, int32_t *max,
const uvc::xu &xu, uint8_t selector, uint8_t id, int32_t *min, int32_t *max,
int32_t *def) const {
CHECK_NOTNULL(device_);
return uvc::xu_control_range(*device_, xu, selector, min, max, def);
return uvc::xu_control_range(*device_, xu, selector, id, min, max, def);
}
bool Channels::XuControlQuery(
@@ -983,14 +983,8 @@ Channels::control_info_t Channels::PuControlInfo(Option option) const {
Channels::control_info_t Channels::XuControlInfo(Option option) const {
int id = XuCamCtrlId(option);
std::uint8_t data[3] = {static_cast<std::uint8_t>((id | 0x80) & 0xFF), 0, 0};
if (!XuCamCtrlQuery(uvc::XU_QUERY_SET, 3, data)) {
LOG(WARNING) << "Get XuControlInfo of " << option << " failed";
return {0, 0, 0};
}
int32_t min = 0, max = 0, def = 0;
if (!XuControlRange(CHANNEL_CAM_CTRL, &min, &max, &def)) {
if (!XuControlRange(CHANNEL_CAM_CTRL, static_cast<std::uint8_t>(id), &min, &max, &def)) {
LOG(WARNING) << "Get XuControlInfo of " << option << " failed";
}
return {min, max, def};

View File

@@ -98,9 +98,9 @@ class MYNTEYE_API Channels {
bool PuControlQuery(Option option, uvc::pu_query query, int32_t *value) const;
bool XuControlRange(
channel_t channel, int32_t *min, int32_t *max, int32_t *def) const;
channel_t channel, uint8_t id, int32_t *min, int32_t *max, int32_t *def) const;
bool XuControlRange(
const uvc::xu &xu, uint8_t selector, int32_t *min, int32_t *max,
const uvc::xu &xu, uint8_t selector, uint8_t id, int32_t *min, int32_t *max,
int32_t *def) const;
bool XuControlQuery(