fix(utils): fix request map uncompatible bug

n
This commit is contained in:
kalman 2019-03-16 11:40:08 +08:00
parent fd551de04b
commit 3bef119492

View File

@ -42,7 +42,8 @@ std::shared_ptr<Device> select() {
auto &&device = devices[i]; auto &&device = devices[i];
LOG(INFO) << " index: " << i LOG(INFO) << " index: " << i
<< ", name: " << device->GetInfo(Info::DEVICE_NAME) << ", name: " << device->GetInfo(Info::DEVICE_NAME)
<< ", sn: " << device->GetInfo(Info::SERIAL_NUMBER); << ", sn: " << device->GetInfo(Info::SERIAL_NUMBER)
<< ", firmware: " << device->GetInfo(Info::FIRMWARE_VERSION);
} }
std::shared_ptr<Device> device = nullptr; std::shared_ptr<Device> device = nullptr;
@ -70,13 +71,18 @@ MYNTEYE_NAMESPACE::StreamRequest select_request(
const std::shared_ptr<Device> &device, bool *ok) { const std::shared_ptr<Device> &device, bool *ok) {
auto &&requests = device->GetStreamRequests(); auto &&requests = device->GetStreamRequests();
std::size_t n = requests.size(); std::size_t n = requests.size();
// TODO(Kalman): Get request size by uvc enum
if (device->GetModel() == Model::STANDARD &&
device->GetInfo()->firmware_version < Version(2, 4)) {
n -= 1;
}
if (n <= 0) { if (n <= 0) {
LOG(ERROR) << "No MYNT EYE devices :("; LOG(ERROR) << "No MYNT EYE devices :(";
*ok = false; *ok = false;
return {}; return {};
} }
LOG(INFO) << "MYNT EYE devices:"; LOG(INFO) << "MYNT EYE requests:";
for (std::size_t i = 0; i < n; i++) { for (std::size_t i = 0; i < n; i++) {
auto &&request = requests[i]; auto &&request = requests[i];
LOG(INFO) << " index: " << i LOG(INFO) << " index: " << i