tm-boot.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "../usb/usb-device.h"
7 #include "../usb/usb-enumerator.h"
8 #include "../types.h"
9 
10 #ifdef WITH_TRACKING
11 #include "common/fw/target.h"
12 #endif
13 
14 namespace librealsense {
15  namespace platform {
16 #ifdef WITH_TRACKING
17  bool tm_boot(const std::vector<usb_device_info> & devices)
18  {
19  bool found = false;
20  for(const auto & device_info : devices) {
21  if(device_info.vid == 0x03E7 && device_info.pid == 0x2150) {
22  LOG_INFO("Found a T265 to boot");
23  found = true;
24  auto dev = usb_enumerator::create_usb_device(device_info);
25  if (const auto& m = dev->open(0))
26  {
27  // transfer the firmware data
28  int size{};
29  auto target_hex = fw_get_target(size);
30 
31  if(!target_hex)
32  LOG_ERROR("librealsense failed to get T265 FW resource");
33 
34  auto iface = dev->get_interface(0);
35  auto endpoint = iface->first_endpoint(RS2_USB_ENDPOINT_DIRECTION_WRITE);
36  uint32_t transfered = 0;
37  auto status = m->bulk_transfer(endpoint, const_cast<uint8_t*>(target_hex), static_cast<uint32_t>(size), transfered, 1000);
39  LOG_ERROR("Error booting T265");
40  }
41  else
42  LOG_ERROR("Failed to open T265 zero interface");
43  }
44  }
45  return found;
46  }
47 #else
48  bool tm_boot(const std::vector<usb_device_info> & devices)
49  {
50  return false;
51  }
52 #endif
53  }
54 }
static rs_usb_device create_usb_device(const usb_device_info &info)
const GLfloat * m
Definition: glext.h:6814
bool tm_boot(const std::vector< usb_device_info > &devices)
Definition: tm-boot.h:48
status
Defines return codes that SDK interfaces use. Negative values indicate errors, a zero value indicates...
GLsizeiptr size
unsigned int uint32_t
Definition: stdint.h:80
devices
Definition: test-fg.py:9
#define LOG_ERROR(...)
Definition: src/types.h:242
LOG_INFO("Log message using LOG_INFO()")


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:12