feat(android): specify uvc packet bytes

This commit is contained in:
John Zhao 2019-03-02 11:20:58 +08:00
parent dc4a21d635
commit f7df7db10b
4 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include "stream_data_impl.hpp" #include "stream_data_impl.hpp"
#include "mynteye/uvc/uvc.h" #include "mynteye/uvc/uvc.h"
#include "mynteye/util/strings.h"
#include "internal/uvc_device.h" #include "internal/uvc_device.h"
MYNTEYE_USE_NAMESPACE MYNTEYE_USE_NAMESPACE
@ -58,6 +59,14 @@ std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info
auto pid = uvc::get_product_id(*device); auto pid = uvc::get_product_id(*device);
VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex
<< vid << ", pid: 0x" << std::hex << pid; << vid << ", pid: 0x" << std::hex << pid;
if (strings::starts_with(name, "MYNT-EYE-")) {
std::string model_s = name.substr(9, 5);
if (strings::starts_with(model_s, "S1")) {
uvc::set_bytes_per_packet(device, 0x4000);
} else if (strings::starts_with(model_s, "S2")) {
uvc::set_bytes_per_packet(device, 0x5400);
}
}
return std::make_shared<DeviceImpl>( return std::make_shared<DeviceImpl>(
MYNTEYE_NAMESPACE::Device::Create(name, device)); MYNTEYE_NAMESPACE::Device::Create(name, device));
} }

View File

@ -9,6 +9,7 @@ namespace uvc {
struct device; struct device;
MYNTEYE_API std::shared_ptr<device> create_device(UsbInfo info); MYNTEYE_API std::shared_ptr<device> create_device(UsbInfo info);
MYNTEYE_API void set_bytes_per_packet(std::shared_ptr<device>, int bytes);
} // namespace uvc } // namespace uvc