usb_depth_sensor_linux.cpp
Go to the documentation of this file.
1 /*
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2019, Analog Devices, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
35 #include "usb_buffer.pb.h"
36 #include "usb_linux_utils.h"
37 
38 #include <cmath>
39 #include <fcntl.h>
40 #ifdef USE_GLOG
41 #include <glog/logging.h>
42 #else
43 #include <aditof/log.h>
44 #include <unistd.h>
45 #endif
46 #include <linux/usb/video.h>
47 #include <linux/uvcvideo.h>
48 #include <linux/videodev2.h>
49 #include <sys/mman.h>
50 #include <unordered_map>
51 
52 struct buffer {
53  void *start;
54  size_t length;
55 };
56 
57 struct CalibrationData {
59  float gain;
60  float offset;
61  uint16_t *cache;
62 };
63 
65  int fd;
66  struct buffer *buffers;
67  unsigned int buffersCount;
68  struct v4l2_format fmt;
69  bool opened;
70  bool started;
71  std::unordered_map<std::string, CalibrationData> calibration_cache;
72 };
73 
75  const std::string &driverPath)
76  : m_driverPath(driverPath), m_implData(new UsbDepthSensor::ImplData) {
77  m_implData->fd = 0;
78  m_implData->opened = false;
79  m_implData->started = false;
80  m_implData->buffers = nullptr;
81  m_implData->buffersCount = 0;
84 }
85 
87  if (m_implData->started) {
88  stop();
89  }
90 
91  for (auto it = m_implData->calibration_cache.begin();
92  it != m_implData->calibration_cache.begin(); ++it) {
93  delete[] it->second.cache;
94  it->second.cache = nullptr;
95  }
96 
97  for (unsigned int i = 0; i < m_implData->buffersCount; ++i) {
98  if (-1 == munmap(m_implData->buffers[i].start,
99  m_implData->buffers[i].length)) {
100  LOG(WARNING) << "munmap, error:" << errno << "(" << strerror(errno)
101  << ")";
102  return;
103  }
104  }
105  if (m_implData->buffers)
106  free(m_implData->buffers);
107 
108  if (m_implData->fd != 0) {
109  if (-1 == close(m_implData->fd))
110  LOG(WARNING) << "close, error:" << errno << "(" << strerror(errno)
111  << ")";
112  }
113 }
114 
116  using namespace aditof;
117  Status status = Status::OK;
118  std::string availableModeDetailsBlob;
119 
120  LOG(INFO) << "Opening device";
121 
122  m_implData->fd = ::open(m_driverPath.c_str(), O_RDWR | O_NONBLOCK, 0);
123  if (-1 == m_implData->fd) {
124  LOG(WARNING) << "Cannot open '" << m_driverPath << "' error: " << errno
125  << "(" << strerror(errno) << ")";
126  return Status::UNREACHABLE;
127  }
128 
129  CLEAR(m_implData->fmt);
130 
131  m_implData->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
132  // Preserve original settings as set by v4l2-ctl for example
133  if (-1 ==
134  UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_G_FMT, &m_implData->fmt)) {
135  LOG(WARNING) << "VIDIOC_G_FMT, error:" << errno << "("
136  << strerror(errno) << ")";
137  return Status::GENERIC_ERROR;
138  }
139 
140  // Query the target about the frame types that are supported by the depth sensor
141 
142  // Send request
143  usb_payload::ClientRequest requestMsg;
144  requestMsg.set_func_name(usb_payload::FunctionName::GET_AVAILABLE_MODES);
145  std::string requestStr;
146  requestMsg.SerializeToString(&requestStr);
147  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
148  if (status != aditof::Status::OK) {
149  LOG(ERROR) << "Request to get available modes failed";
150  return status;
151  }
152 
153  // Read UVC gadget response
156  if (status != aditof::Status::OK) {
157  LOG(ERROR) << "Response for get available frame types request failed";
158  return status;
159  }
160  usb_payload::ServerResponse responseMsg;
161  bool parsed = responseMsg.ParseFromString(responseStr);
162  if (!parsed) {
163  LOG(ERROR)
164  << "Failed to deserialize string containing UVC gadget response";
166  }
167 
168  if (responseMsg.status() != usb_payload::Status::OK) {
169  LOG(ERROR)
170  << "Get available frame types operation failed on UVC gadget";
171  return static_cast<aditof::Status>(responseMsg.status());
172  }
173 
174  // If request and response went well, extract data from response
176  m_depthSensorModes, responseMsg.available_mode_details());
177 
178  m_implData->opened = true;
179 
180  return status;
181 }
182 
184  using namespace aditof;
185 
186  if (m_implData->started) {
187  LOG(INFO) << "Device already started";
188  return Status::BUSY;
189  }
190  LOG(INFO) << "Starting device";
191 
192  struct v4l2_streamparm fpsControl;
193  memset(&fpsControl, 0, sizeof(struct v4l2_streamparm));
194 
195  fpsControl.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
196  fpsControl.parm.capture.timeperframe.numerator = 1;
197  fpsControl.parm.capture.timeperframe.denominator = m_fps;
198 
199  if (UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_S_PARM, &fpsControl) ==
200  -1) {
201  LOG(WARNING) << "Failed to set control: "
202  << " "
203  << "errno: " << errno << " error: " << strerror(errno);
204  return Status::GENERIC_ERROR;
205  }
206 
207  enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
208  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_STREAMON, &type)) {
209  LOG(WARNING) << "VIDIOC_STREAMON, error:" << errno << "("
210  << strerror(errno) << ")";
211  return Status::GENERIC_ERROR;
212  }
213 
214  m_implData->started = true;
215 
216  return Status::OK;
217 }
218 
220  using namespace aditof;
221 
222  if (!m_implData->started) {
223  LOG(INFO) << "Device already stopped";
224  return Status::BUSY;
225  }
226  LOG(INFO) << "Stopping device";
227 
228  enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
229  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_STREAMOFF, &type)) {
230  LOG(WARNING) << "VIDIOC_STREAMOFF, error:" << errno << "("
231  << strerror(errno) << ")";
232  return Status::GENERIC_ERROR;
233  }
234 
235  m_implData->started = false;
236 
237  return Status::OK;
238 }
239 
241 UsbDepthSensor::getAvailableModes(std::vector<std::uint8_t> &modes) {
242  modes.clear();
243  for (const auto &frameType : m_depthSensorModes) {
244  modes.emplace_back(frameType.modeNumber);
245  }
246 
247  return aditof::Status::OK;
248 }
249 
253  using namespace aditof;
254  Status status = Status::OK;
255  for (const auto &frameDetails : m_depthSensorModes) {
256  if (frameDetails.modeNumber == mode) {
257  details = frameDetails;
258  break;
259  }
260  }
261  return status;
262 }
263 
266 }
267 
270  using namespace aditof;
271 
272  Status status = Status::OK;
273 
274  // Send the frame type and all its content all the way to target
275  usb_payload::ClientRequest requestMsg;
276  auto frameTypeMsg = requestMsg.mutable_mode_details();
278  // Send request
279  requestMsg.set_func_name(usb_payload::FunctionName::SET_MODE);
280  std::string requestStr;
281  requestMsg.SerializeToString(&requestStr);
282  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
283  if (status != Status::OK) {
284  LOG(ERROR) << "Set frame type operation failed on UVC gadget";
285  return status;
286  }
287  struct v4l2_requestbuffers req;
288 
289  req.count = 0;
290  req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
291  req.memory = V4L2_MEMORY_MMAP;
292  if (UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_REQBUFS, &req) == -1) {
293  LOG(WARNING) << "VIDIOC_REQBUFS error "
294  << "errno: " << errno << " error: " << strerror(errno);
295  return Status::GENERIC_ERROR;
296  }
297 
298  bool found = false;
299  struct v4l2_fmtdesc fmtdesc;
300  memset(&fmtdesc, 0, sizeof(fmtdesc));
301  fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
302  while (UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_ENUM_FMT, &fmtdesc) ==
303  0) {
304  struct v4l2_frmsizeenum frmenum;
305  memset(&frmenum, 0, sizeof frmenum);
306  frmenum.pixel_format = fmtdesc.pixelformat;
307  while (UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_ENUM_FRAMESIZES,
308  &frmenum) == 0) {
309  if ((frmenum.discrete.width == type.frameWidthInBytes) &&
310  (frmenum.discrete.height == type.frameHeightInBytes)) {
311  found = true;
312  break;
313  }
314  frmenum.index++;
315  }
316  if (found)
317  break;
318  else
319  fmtdesc.index++;
320  }
321 
322  if (!found) {
323  LOG(WARNING) << "UVC does not support the requested format "
324  << "errno: " << errno << " error: " << strerror(errno);
325  return Status::GENERIC_ERROR;
326  }
327 
328  m_implData->fmt.fmt.pix.width = type.frameWidthInBytes;
329  m_implData->fmt.fmt.pix.height = type.frameHeightInBytes;
330  m_implData->fmt.fmt.pix.pixelformat = fmtdesc.pixelformat;
331  m_implData->fmt.fmt.pix.field = V4L2_FIELD_ANY;
332 
333  if (-1 ==
334  UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_S_FMT, &m_implData->fmt)) {
335  LOG(WARNING) << "Failed to set Pixel Format, error: " << errno << "("
336  << strerror(errno) << ")";
337  return Status::GENERIC_ERROR;
338  }
339 
340  CLEAR(req);
341  req.count = 4;
342  req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
343  req.memory = V4L2_MEMORY_MMAP;
344 
345  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_REQBUFS, &req)) {
346  if (EINVAL == errno) {
347  LOG(WARNING) << m_driverPath << " does not support memmory mapping";
348  } else {
349  LOG(WARNING) << "VIDIOC_REQBUFS, error:" << errno << "("
350  << strerror(errno) << ")";
351  }
352  return Status::GENERIC_ERROR;
353  }
354 
355  if (req.count < 2) {
356  LOG(WARNING) << "Insufficient buffer memory on " << m_driverPath;
357  return Status::GENERIC_ERROR;
358  }
359 
360  if (!m_implData->buffers) {
361  m_implData->buffers =
362  static_cast<buffer *>(calloc(req.count, sizeof(struct buffer)));
363  }
364 
365  if (!m_implData->buffers) {
366  LOG(WARNING) << "Out of memory";
367  return Status::GENERIC_ERROR;
368  }
369 
370  for (m_implData->buffersCount = 0; m_implData->buffersCount < req.count;
371  ++m_implData->buffersCount) {
372  struct v4l2_buffer buf;
373 
374  CLEAR(buf);
375 
376  buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
377  buf.memory = V4L2_MEMORY_MMAP;
378  buf.index = m_implData->buffersCount;
379 
380  if (-1 ==
381  UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_QUERYBUF, &buf)) {
382  LOG(WARNING) << "VIDIOC_QUERYBUF, error:" << errno << "("
383  << strerror(errno) << ")";
384  return Status::GENERIC_ERROR;
385  }
386 
387  // TO DO: Check if is better to use mremap()
388 
389  m_implData->buffers[m_implData->buffersCount].length = buf.length;
390  m_implData->buffers[m_implData->buffersCount].start =
391  mmap(nullptr, // start anywhere ,
392  buf.length,
393  PROT_READ | PROT_WRITE, // required,
394  MAP_SHARED, // recommended ,
395  m_implData->fd, buf.m.offset);
396 
397  if (MAP_FAILED == m_implData->buffers[m_implData->buffersCount].start) {
398  LOG(WARNING) << "mmap, error:" << errno << "(" << strerror(errno)
399  << ")";
400  return Status::GENERIC_ERROR;
401  }
402  }
403 
404  for (unsigned int i = 0; i < m_implData->buffersCount; ++i) {
405  struct v4l2_buffer buf;
406 
407  CLEAR(buf);
408  buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
409  buf.memory = V4L2_MEMORY_MMAP;
410  buf.index = i;
411 
412  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_QBUF, &buf)) {
413  LOG(WARNING) << "VIDIOC_QBUF, error:" << errno << "("
414  << strerror(errno) << ")";
415  return Status::GENERIC_ERROR;
416  }
417  }
418 
419  return status;
420 }
421 
423  using namespace aditof;
424  Status status = Status::OK;
425 
426  if (!buffer) {
427  LOG(WARNING) << "Invalid adddress to buffer provided";
429  }
430 
431  fd_set fds;
432  struct timeval tv;
433  int r;
434 
435  FD_ZERO(&fds);
436  FD_SET(m_implData->fd, &fds);
437 
438  // Timeout : Ensure this compensates for max delays added for programming
439  // cycle defined in 'Device::program'
440  tv.tv_sec = 5;
441  tv.tv_usec = 0;
442 
443  r = select(m_implData->fd + 1, &fds, nullptr, nullptr, &tv);
444 
445  if (-1 == r) {
446  if (EINTR == errno) {
447  LOG(WARNING) << "select, error: " << errno << "(" << strerror(errno)
448  << ")";
449  return Status::GENERIC_ERROR;
450  }
451  }
452 
453  if (0 == r) {
454  LOG(WARNING) << "select timeout: ";
455  return Status::BUSY;
456  }
457 
458  struct v4l2_buffer buf;
459 
460  CLEAR(buf);
461 
462  buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
463  buf.memory = V4L2_MEMORY_MMAP;
464 
465  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_DQBUF, &buf)) {
466  LOG(WARNING) << "Stream Error";
467  switch (errno) {
468  case EAGAIN:
469  break;
470 
471  case EIO:
472  // Could ignore EIO, see spec.
473  // fall through
474 
475  default: {
476  LOG(WARNING) << "VIDIOC_DQBUF, error: " << errno << "("
477  << strerror(errno) << ")";
478  return Status::GENERIC_ERROR;
479  }
480  }
481  }
482 
483  if (buf.index >= m_implData->buffersCount) {
484  LOG(WARNING) << "buffer index out of range";
486  }
487 
488  const char *pdata =
489  static_cast<const char *>(m_implData->buffers[buf.index].start);
490 
491  memcpy(buffer, pdata, m_implData->buffers[buf.index].length);
492 
493  if (-1 == UsbLinuxUtils::xioctl(m_implData->fd, VIDIOC_QBUF, &buf)) {
494  LOG(WARNING) << "VIDIOC_QBUF, error: " << errno << "("
495  << strerror(errno) << ")";
496  return Status::GENERIC_ERROR;
497  }
498 
499  return status;
500 }
501 
503 UsbDepthSensor::getAvailableControls(std::vector<std::string> &controls) const {
504  using namespace aditof;
505  Status status = Status::OK;
506 
507  // Construct request message
508  usb_payload::ClientRequest requestMsg;
509  requestMsg.set_func_name(usb_payload::FunctionName::GET_AVAILABLE_CONTROLS);
510 
511  // Send request
512  std::string requestStr;
513  requestMsg.SerializeToString(&requestStr);
514  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
515  if (status != aditof::Status::OK) {
516  LOG(ERROR) << "Request to get available controls failed";
517  return status;
518  }
519 
520  // Read UVC gadget response
523  if (status != aditof::Status::OK) {
524  LOG(ERROR) << "Failed to get response of the request to get controls";
525  return status;
526  }
527  usb_payload::ServerResponse responseMsg;
528  bool parsed = responseMsg.ParseFromString(responseStr);
529  if (!parsed) {
530  LOG(ERROR)
531  << "Failed to deserialize string containing UVC gadget response";
533  }
534 
535  if (responseMsg.status() != usb_payload::Status::OK) {
536  LOG(ERROR) << "Get available controls operation failed on UVC gadget";
537  return static_cast<aditof::Status>(responseMsg.status());
538  }
539 
540  controls.clear();
541 
542  for (int i = 0; i < responseMsg.strings_payload_size(); i++) {
543  std::string controlName = responseMsg.strings_payload(i);
544  controls.push_back(controlName);
545  }
546 
547  return Status::OK;
548 }
549 
551  const std::string &value) {
552  using namespace aditof;
553  Status status = Status::OK;
554 
555  if (control == "fps") {
556  m_fps = std::stoi(value);
557  return status;
558  }
559 
560  // Construct request message
561  usb_payload::ClientRequest requestMsg;
562  requestMsg.set_func_name(usb_payload::FunctionName::SET_CONTROL);
563  requestMsg.add_func_strings_param(control);
564  requestMsg.add_func_strings_param(value);
565 
566  // Send request
567  std::string requestStr;
568  requestMsg.SerializeToString(&requestStr);
569  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
570  if (status != aditof::Status::OK) {
571  LOG(ERROR) << "Request to set control failed: " << control;
572  return status;
573  }
574 
575  // Read UVC gadget response
578  if (status != aditof::Status::OK) {
579  LOG(ERROR) << "Failed to get response of the request to set control: "
580  << control;
581  return status;
582  }
583  usb_payload::ServerResponse responseMsg;
584  bool parsed = responseMsg.ParseFromString(responseStr);
585  if (!parsed) {
586  LOG(ERROR)
587  << "Failed to deserialize string containing UVC gadget response";
589  }
590 
591  if (responseMsg.status() != usb_payload::Status::OK) {
592  LOG(ERROR) << "Set control:" << control
593  << " operation failed on UVC gadget";
594  return static_cast<aditof::Status>(responseMsg.status());
595  }
596 
597  return Status::OK;
598 }
599 
601  std::string &value) const {
602  using namespace aditof;
603  Status status = Status::OK;
604 
605  // Construct request message
606  usb_payload::ClientRequest requestMsg;
607  requestMsg.set_func_name(usb_payload::FunctionName::GET_CONTROL);
608  requestMsg.add_func_strings_param(control);
609 
610  // Send request
611  std::string requestStr;
612  requestMsg.SerializeToString(&requestStr);
613  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
614  if (status != aditof::Status::OK) {
615  LOG(ERROR) << "Request to get control: " << control << " failed";
616  return status;
617  }
618 
619  // Read UVC gadget response
622  if (status != aditof::Status::OK) {
623  LOG(ERROR) << "Failed to get response of the request to get control: "
624  << control;
625  return status;
626  }
627  usb_payload::ServerResponse responseMsg;
628  bool parsed = responseMsg.ParseFromString(responseStr);
629  if (!parsed) {
630  LOG(ERROR)
631  << "Failed to deserialize string containing UVC gadget response";
633  }
634 
635  if (responseMsg.status() != usb_payload::Status::OK) {
636  LOG(ERROR) << "Get control: " << control
637  << " operation failed on UVC gadget";
638  return static_cast<aditof::Status>(responseMsg.status());
639  }
640 
641  value = responseMsg.strings_payload(0);
642 
643  return Status::OK;
644 }
645 
648  details = m_sensorDetails;
649  return aditof::Status::OK;
650 }
651 
653  if (m_implData->opened) {
654  *handle = &m_implData->fd;
655  return aditof::Status::OK;
656  } else {
657  *handle = nullptr;
658  LOG(ERROR) << "Won't return the handle. Device hasn't been opened yet.";
660  }
661 }
662 
664  name = m_sensorName;
665  return aditof::Status::OK;
666 }
667 
670  LOG(INFO) << "Function used only on target!";
671  return aditof::Status::OK;
672 }
673 
675  unsigned int usDelay) {
676  using namespace aditof;
677  Status status = Status::OK;
678 
679  // Construct request message
680  usb_payload::ClientRequest requestMsg;
681  requestMsg.set_func_name(usb_payload::FunctionName::ADSD3500_READ_CMD);
682  requestMsg.add_func_int32_param(static_cast<::google::int32>(cmd));
683  requestMsg.add_func_int32_param(static_cast<::google::int32>(usDelay));
684 
685  // Send request
686  std::string requestStr;
687  requestMsg.SerializeToString(&requestStr);
688  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
689  if (status != aditof::Status::OK) {
690  LOG(ERROR) << "Request to read " << cmd << " adsd3500 command failed";
691  return status;
692  }
693 
694  // Read UVC gadget response
697  if (status != aditof::Status::OK) {
698  LOG(ERROR) << "Failes to get respode to " << cmd << " adsd3500 command";
699  return status;
700  }
701  usb_payload::ServerResponse responseMsg;
702  bool parsed = responseMsg.ParseFromString(responseStr);
703  if (!parsed) {
704  LOG(ERROR)
705  << "Failed to deserialize string containing UVC gadget response";
707  }
708 
709  if (responseMsg.status() != usb_payload::Status::OK) {
710  LOG(ERROR) << "Adsd3500 command read:" << cmd
711  << " operation failed on UVC gadget";
712  return static_cast<aditof::Status>(responseMsg.status());
713  }
714 
715  // If request and response went well, extract data from response
716  memcpy(data, responseMsg.bytes_payload(0).c_str(), sizeof(uint16_t));
717 
718  return Status::OK;
719 }
720 
722  unsigned int usDelay) {
723  using namespace aditof;
724  Status status = Status::OK;
725 
726  // Construct request message
727  usb_payload::ClientRequest requestMsg;
728  requestMsg.set_func_name(usb_payload::FunctionName::ADSD3500_WRITE_CMD);
729  requestMsg.add_func_int32_param(static_cast<::google::int32>(cmd));
730  requestMsg.add_func_bytes_param(&data, sizeof(uint16_t));
731 
732  // Send request
733  std::string requestStr;
734  requestMsg.SerializeToString(&requestStr);
735  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
736  if (status != aditof::Status::OK) {
737  LOG(ERROR) << "Request to write " << cmd << " adsd3500 command failed";
738  return status;
739  }
740 
741  // Read UVC gadget response
744  if (status != aditof::Status::OK) {
745  LOG(ERROR) << "Failes to get respode to " << cmd << " adsd3500 command";
746  return status;
747  }
748  usb_payload::ServerResponse responseMsg;
749  bool parsed = responseMsg.ParseFromString(responseStr);
750  if (!parsed) {
751  LOG(ERROR)
752  << "Failed to deserialize string containing UVC gadget response";
754  }
755 
756  if (responseMsg.status() != usb_payload::Status::OK) {
757  LOG(ERROR) << "Adsd3500 command write:" << cmd
758  << " operation failed on UVC gadget";
759  return static_cast<aditof::Status>(responseMsg.status());
760  }
761 
762  return Status::OK;
763 }
764 
766  uint8_t *readback_data,
767  uint16_t payload_len) {
768  using namespace aditof;
769  Status status = Status::OK;
770 
771  // Construct request message
772  usb_payload::ClientRequest requestMsg;
773  requestMsg.set_func_name(
775  requestMsg.add_func_int32_param(static_cast<::google::int32>(cmd));
776  requestMsg.add_func_int32_param(static_cast<::google::int32>(payload_len));
777  requestMsg.add_func_bytes_param(readback_data, 4 * sizeof(uint8_t));
778 
779  // Send request
780  std::string requestStr;
781  requestMsg.SerializeToString(&requestStr);
782  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
783  if (status != aditof::Status::OK) {
784  LOG(ERROR) << "Request to read " << cmd
785  << " adsd3500 payload command failed";
786  return status;
787  }
788 
789  // Read UVC gadget response
792  if (status != aditof::Status::OK) {
793  LOG(ERROR) << "Failed to get respode to " << cmd
794  << " adsd3500 payload read command";
795  return status;
796  }
797  usb_payload::ServerResponse responseMsg;
798  bool parsed = responseMsg.ParseFromString(responseStr);
799  if (!parsed) {
800  LOG(ERROR)
801  << "Failed to deserialize string containing UVC gadget response";
803  }
804 
805  if (responseMsg.status() != usb_payload::Status::OK) {
806  LOG(ERROR) << "Adsd3500 payload command read:" << cmd
807  << " operation failed on UVC gadget";
808  return static_cast<aditof::Status>(responseMsg.status());
809  }
810  // If request and response went well, extract data from response
811  memcpy((uint16_t *)readback_data, responseMsg.bytes_payload(0).c_str(),
812  payload_len * sizeof(uint8_t));
813 
814  return Status::OK;
815 }
816 
818  uint16_t payload_len) {
819  using namespace aditof;
820  Status status = Status::OK;
821 
822  // Construct request message
823  usb_payload::ClientRequest requestMsg;
824  requestMsg.set_func_name(usb_payload::FunctionName::ADSD3500_WRITE_PAYLOAD);
825  requestMsg.add_func_int32_param(static_cast<::google::int32>(payload_len));
826 
827  // Send request
828  std::string requestStr;
829  requestMsg.SerializeToString(&requestStr);
830  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
831  if (status != aditof::Status::OK) {
832  LOG(ERROR) << "Request to read adsd3500 payload failed";
833  return status;
834  }
835 
836  // Read UVC gadget response
839  if (status != aditof::Status::OK) {
840  LOG(ERROR) << "Failes to get respode to adsd3500 payload";
841  return status;
842  }
843  usb_payload::ServerResponse responseMsg;
844  bool parsed = responseMsg.ParseFromString(responseStr);
845  if (!parsed) {
846  LOG(ERROR)
847  << "Failed to deserialize string containing UVC gadget response";
849  }
850 
851  if (responseMsg.status() != usb_payload::Status::OK) {
852  LOG(ERROR) << "Adsd3500 payload read: operation failed on UVC gadget";
853  return static_cast<aditof::Status>(responseMsg.status());
854  }
855  // If request and response went well, extract data from response
856  memcpy(payload, responseMsg.bytes_payload(0).c_str(),
857  payload_len * sizeof(uint8_t));
858 
859  return Status::OK;
860 }
861 
863 UsbDepthSensor::adsd3500_write_payload_cmd(uint32_t cmd, uint8_t *payload,
864  uint16_t payload_len) {
865  using namespace aditof;
866  Status status = Status::OK;
867 
868  // Construct request message
869  usb_payload::ClientRequest requestMsg;
870  requestMsg.set_func_name(
872  requestMsg.add_func_int32_param(static_cast<::google::int32>(cmd));
873  requestMsg.add_func_int32_param(static_cast<::google::int32>(payload_len));
874  requestMsg.add_func_bytes_param(payload, payload_len);
875 
876  // Send request
877  std::string requestStr;
878  requestMsg.SerializeToString(&requestStr);
879  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
880  if (status != aditof::Status::OK) {
881  LOG(ERROR) << "Request to write " << cmd
882  << " adsd3500 payload command failed";
883  return status;
884  }
885 
886  // Read UVC gadget response
889  if (status != aditof::Status::OK) {
890  LOG(ERROR) << "Failes to get respode to " << cmd
891  << " adsd3500 payload write command";
892  return status;
893  }
894  usb_payload::ServerResponse responseMsg;
895  bool parsed = responseMsg.ParseFromString(responseStr);
896  if (!parsed) {
897  LOG(ERROR)
898  << "Failed to deserialize string containing UVC gadget response";
900  }
901 
902  if (responseMsg.status() != usb_payload::Status::OK) {
903  LOG(ERROR) << "Adsd3500 payload command write:" << cmd
904  << " operation failed on UVC gadget";
905  return static_cast<aditof::Status>(responseMsg.status());
906  }
907 
908  return Status::OK;
909 }
910 
912  uint16_t payload_len) {
913  using namespace aditof;
914  Status status = Status::OK;
915 
916  // Construct request message
917  usb_payload::ClientRequest requestMsg;
918  requestMsg.set_func_name(usb_payload::FunctionName::ADSD3500_WRITE_PAYLOAD);
919  requestMsg.add_func_int32_param(static_cast<::google::int32>(payload_len));
920  requestMsg.add_func_bytes_param(payload, payload_len);
921 
922  // Send request
923  std::string requestStr;
924  requestMsg.SerializeToString(&requestStr);
925  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
926  if (status != aditof::Status::OK) {
927  LOG(ERROR) << "Request to write adsd3500 payload failed";
928  return status;
929  }
930 
931  // Read UVC gadget response
934  if (status != aditof::Status::OK) {
935  LOG(ERROR) << "Failes to get respode to adsd3500 payload write";
936 
937  return status;
938  }
939  usb_payload::ServerResponse responseMsg;
940  bool parsed = responseMsg.ParseFromString(responseStr);
941  if (!parsed) {
942  LOG(ERROR)
943  << "Failed to deserialize string containing UVC gadget response";
945  }
946 
947  if (responseMsg.status() != usb_payload::Status::OK) {
948  LOG(ERROR) << "Adsd3500 payload write: operation failed on UVC gadget";
949  return static_cast<aditof::Status>(responseMsg.status());
950  }
951 
952  return Status::OK;
953 }
954 
956  using namespace aditof;
957  Status status = Status::OK;
958 
959  // Construct request message
960  usb_payload::ClientRequest requestMsg;
961  requestMsg.set_func_name(usb_payload::FunctionName::ADSD3500_RESET);
962 
963  // Send request
964  std::string requestStr;
965  requestMsg.SerializeToString(&requestStr);
966  status = UsbLinuxUtils::uvcExUnitSendRequest(m_implData->fd, requestStr);
967  if (status != aditof::Status::OK) {
968  LOG(ERROR) << "Request to write adsd3500 payload failed";
969  return status;
970  }
971 
972  // Read UVC gadget response
975  if (status != aditof::Status::OK) {
976  LOG(ERROR) << "Failes to get respode to adsd3500 payload write";
977 
978  return status;
979  }
980  usb_payload::ServerResponse responseMsg;
981  bool parsed = responseMsg.ParseFromString(responseStr);
982  if (!parsed) {
983  LOG(ERROR)
984  << "Failed to deserialize string containing UVC gadget response";
986  }
987 
988  if (responseMsg.status() != usb_payload::Status::OK) {
989  LOG(ERROR) << "Adsd3500 payload write: operation failed on UVC gadget";
990  return static_cast<aditof::Status>(responseMsg.status());
991  }
992 
993  return Status::OK;
994 }
995 
998  LOG(WARNING) << "Registering an interrupt callback on a USB connection "
999  "is not supported yet!";
1001 }
1002 
1005  LOG(WARNING) << "Unregistering an interrupt callback on a USB connection "
1006  "is not supported yet!";
1008 }
1009 
1011  int &imagerStatus) {
1012  using namespace aditof;
1013  Status status = Status::UNAVAILABLE;
1014  return status;
1015 }
1016 
1018  uint16_t iniFileLength,
1019  uint8_t *calData,
1020  uint16_t calDataLength) {
1021  return aditof::Status::OK;
1022 }
1023 
1025  std::map<std::string, std::string> &params) {
1026  using namespace aditof;
1027  Status status = Status::UNAVAILABLE;
1028  return status;
1029 }
1030 
1032  const std::map<std::string, std::string> &params) {
1033  using namespace aditof;
1034  Status status = Status::UNAVAILABLE;
1035  return status;
1036 }
1037 
1040  // TODO: select sensor table configuration
1041  return aditof::Status::OK;
1042 }
1043 
1045  std::string &iniStr) {
1046 
1047  return aditof::Status::OK;
1048 }
usb_depth_sensor.h
INFO
const int INFO
Definition: log_severity.h:59
name
GLuint const GLchar * name
Definition: glcorearb.h:3055
aditof::SET_CONTROL
@ SET_CONTROL
Definition: gpio.h:51
UsbDepthSensor::ImplData::fmt
struct v4l2_format fmt
Definition: usb_depth_sensor_linux.cpp:68
UsbDepthSensor::adsd3500_read_payload
virtual aditof::Status adsd3500_read_payload(uint8_t *payload, uint16_t payload_len) override
Reads a chunk of data from adsd3500. This will perform a burst read making it useful for reading chun...
Definition: usb_depth_sensor_linux.cpp:817
UsbDepthSensor::adsd3500_unregister_interrupt_callback
virtual aditof::Status adsd3500_unregister_interrupt_callback(aditof::SensorInterruptCallback &cb) override
Unregister a function registered with adsd3500_register_interrupt_callback.
Definition: usb_depth_sensor_linux.cpp:1003
aditof::ADSD3500_WRITE_PAYLOAD
@ ADSD3500_WRITE_PAYLOAD
Definition: gpio.h:59
UsbDepthSensor::m_fps
int m_fps
Definition: usb_depth_sensor.h:116
aditof::SensorDetails
Provides details about the device.
Definition: sensor_definitions.h:50
aditof::ADSD3500_WRITE_PAYLOAD_CMD
@ ADSD3500_WRITE_PAYLOAD_CMD
Definition: gpio.h:58
ERROR
const int ERROR
Definition: log_severity.h:60
EINTR
#define EINTR
Definition: errno.hpp:7
EINVAL
#define EINVAL
Definition: errno.hpp:25
UsbUtils::depthSensorModeDetailsToProtoMsg
static void depthSensorModeDetailsToProtoMsg(const aditof::DepthSensorModeDetails &depthSensorModeDetails, usb_payload::DepthSensorModeDetails *protoMsg)
Converts a DepthSensorModeDetails to a protobuf message.
Definition: usb_utils.cpp:70
CalibrationData::cache
uint16_t * cache
Definition: network_depth_sensor.cpp:47
CalibrationData::gain
float gain
Definition: network_depth_sensor.cpp:45
mode
GLenum mode
Definition: glcorearb.h:2764
EAGAIN
#define EAGAIN
Definition: errno.hpp:14
log.h
UsbDepthSensor::getName
virtual aditof::Status getName(std::string &name) const override
Get the name of the sensor.
Definition: usb_depth_sensor_linux.cpp:663
UsbDepthSensor::adsd3500_write_payload
virtual aditof::Status adsd3500_write_payload(uint8_t *payload, uint16_t payload_len) override
Send a chunk of data (payload) to adsd3500. This will perform a burst write making it useful for writ...
Definition: usb_depth_sensor_linux.cpp:911
UsbDepthSensor::adsd3500_get_status
virtual aditof::Status adsd3500_get_status(int &chipStatus, int &imagerStatus) override
Returns the chip status.
Definition: usb_depth_sensor_linux.cpp:1010
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
UsbDepthSensor::setMode
virtual aditof::Status setMode(const aditof::DepthSensorModeDetails &type) override
Set the sensor frame mode to the given type.
Definition: usb_depth_sensor_linux.cpp:269
errno
int errno
aditof::ADSD3500_WRITE_CMD
@ ADSD3500_WRITE_CMD
Definition: gpio.h:55
UsbDepthSensor::adsd3500_reset
virtual aditof::Status adsd3500_reset() override
Reset adsd3500 chip.
Definition: usb_depth_sensor_linux.cpp:955
aditof::Status::UNAVAILABLE
@ UNAVAILABLE
The requested action or resource is unavailable.
found
return found
Definition: socket_poller.cpp:456
WARNING
const int WARNING
Definition: log_severity.h:59
UsbDepthSensor::ImplData::fd
int fd
Definition: usb_depth_sensor_linux.cpp:65
UsbDepthSensor::initTargetDepthCompute
virtual aditof::Status initTargetDepthCompute(uint8_t *iniFile, uint16_t iniFileLength, uint8_t *calData, uint16_t calDataLength) override
Get the name of the sensor.
Definition: usb_depth_sensor_linux.cpp:1017
google::protobuf::util::error::UNAVAILABLE
@ UNAVAILABLE
Definition: status.h:62
aditof::GET_CONTROL
@ GET_CONTROL
Definition: gpio.h:52
UsbDepthSensor::getFrame
virtual aditof::Status getFrame(uint16_t *buffer) override
Request a frame from the sensor.
Definition: usb_depth_sensor_linux.cpp:422
responseStr
ROSCPP_DECL XmlRpc::XmlRpcValue responseStr(int code, const std::string &msg, const std::string &response)
UsbDepthSensor
Definition: usb_depth_sensor.h:44
UsbDepthSensor::open
virtual aditof::Status open() override
Open the communication channels with the hardware.
Definition: usb_depth_sensor_linux.cpp:115
UsbDepthSensor::getDetails
virtual aditof::Status getDetails(aditof::SensorDetails &details) const override
Get a structure that contains information about the instance of the sensor.
Definition: usb_depth_sensor_linux.cpp:647
aditof::ADSD3500_READ_PAYLOAD_CMD
@ ADSD3500_READ_PAYLOAD_CMD
Definition: gpio.h:56
UsbDepthSensor::ImplData::buffers
struct buffer * buffers
Definition: usb_depth_sensor_linux.cpp:66
aditof
Namespace aditof.
Definition: adsd_errs.h:40
UsbDepthSensor::adsd3500_write_cmd
virtual aditof::Status adsd3500_write_cmd(uint16_t cmd, uint16_t data, unsigned int usDelay=0) override
Send a write command to adsd3500.
Definition: usb_depth_sensor_linux.cpp:721
aditof::ADSD3500_READ_CMD
@ ADSD3500_READ_CMD
Definition: gpio.h:54
UsbDepthSensor::getControl
virtual aditof::Status getControl(const std::string &control, std::string &value) const override
Gets the value of a specific sensor control.
Definition: usb_depth_sensor_linux.cpp:600
UsbDepthSensor::getAvailableControls
virtual aditof::Status getAvailableControls(std::vector< std::string > &controls) const override
Gets the sensors's list of controls.
Definition: usb_depth_sensor_linux.cpp:503
UsbDepthSensor::m_implData
std::unique_ptr< ImplData > m_implData
Definition: usb_depth_sensor.h:114
UsbDepthSensor::getAvailableModes
virtual aditof::Status getAvailableModes(std::vector< uint8_t > &modes) override
Return all modes that are supported by the sensor.
Definition: usb_depth_sensor_linux.cpp:241
google::protobuf::util::error::OK
@ OK
Definition: status.h:47
buffer::start
void * start
Definition: buffer_processor.h:44
aditof::ConnectionType::USB
@ USB
connects to target via USB
buffer::length
size_t length
Definition: buffer_processor.h:45
UsbDepthSensor::adsd3500_read_cmd
virtual aditof::Status adsd3500_read_cmd(uint16_t cmd, uint16_t *data, unsigned int usDelay=0) override
Send a read command to adsd3500.
Definition: usb_depth_sensor_linux.cpp:674
UsbDepthSensor::adsd3500_register_interrupt_callback
virtual aditof::Status adsd3500_register_interrupt_callback(aditof::SensorInterruptCallback &cb) override
Register a function to be called when a ADSD3500 interrupt occurs.
Definition: usb_depth_sensor_linux.cpp:996
params
GLenum const GLfloat * params
Definition: glcorearb.h:2770
UsbDepthSensor::start
virtual aditof::Status start() override
Start the streaming of data from the sensor.
Definition: usb_depth_sensor_linux.cpp:183
UsbDepthSensor::~UsbDepthSensor
~UsbDepthSensor()
Definition: usb_depth_sensor_linux.cpp:86
UsbDepthSensor::ImplData::started
bool started
Definition: usb_depth_sensor_linux.cpp:70
UsbDepthSensor::m_depthSensorModes
std::vector< aditof::DepthSensorModeDetails > m_depthSensorModes
Definition: usb_depth_sensor.h:115
buffer
Definition: buffer_processor.h:43
UsbDepthSensor::getIniParamsArrayForMode
aditof::Status getIniParamsArrayForMode(int mode, std::string &iniStr) override
Get ini parameters for Depth Compute library as string.
Definition: usb_depth_sensor_linux.cpp:1044
UsbDepthSensor::m_driverPath
std::string m_driverPath
Definition: usb_depth_sensor.h:113
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:4175
google::protobuf::util::error::INVALID_ARGUMENT
@ INVALID_ARGUMENT
Definition: status.h:50
UsbDepthSensor::adsd3500_write_payload_cmd
virtual aditof::Status adsd3500_write_payload_cmd(uint32_t cmd, uint8_t *payload, uint16_t payload_len) override
Send a write command to adsd3500. This will perform a burst write making it useful for writing chunks...
Definition: usb_depth_sensor_linux.cpp:863
CalibrationData
Definition: network_depth_sensor.cpp:43
aditof::Status::INVALID_ARGUMENT
@ INVALID_ARGUMENT
Invalid arguments provided.
aditof::Status
Status
Status of any operation that the TOF sdk performs.
Definition: status_definitions.h:48
i
int i
Definition: gmock-matchers_test.cc:764
UsbDepthSensor::setHostConnectionType
virtual aditof::Status setHostConnectionType(std::string &connectionType) override
Set the host connection type for target sdk.
Definition: usb_depth_sensor_linux.cpp:669
aditof::GET_AVAILABLE_MODES
@ GET_AVAILABLE_MODES
Definition: gpio.h:45
type
GLenum type
Definition: glcorearb.h:2695
UsbUtils::protoMsgToDepthSensorModeDetails
static void protoMsgToDepthSensorModeDetails(std::vector< aditof::DepthSensorModeDetails > &depthSensorModeDetailsVector, const usb_payload::DepthSensorModeDetailsVector &protoMsg)
Converts from protobuf message to aditof type (vector of DepthSensorModeDetails)
Definition: usb_utils.cpp:40
UsbDepthSensor::getHandle
virtual aditof::Status getHandle(void **handle) override
Gets a handle to be used by other devices such as Storage, Temperature, etc. This handle will allow t...
Definition: usb_depth_sensor_linux.cpp:652
LOG
#define LOG(x)
Definition: sdk/include/aditof/log.h:72
req
void * req
Definition: test_req_relaxed.cpp:10
google::int32
int32_t int32
Definition: sdk/include/aditof/log.h:54
aditof::Status::OK
@ OK
Success.
CLEAR
#define CLEAR(x)
Definition: adsd3500_sensor.cpp:43
UsbDepthSensor::setDepthComputeParams
virtual aditof::Status setDepthComputeParams(const std::map< std::string, std::string > &params) override
Set ini parameters for Depth Compute library.
Definition: usb_depth_sensor_linux.cpp:1031
usb_linux_utils.h
UsbDepthSensor::setSensorConfiguration
virtual aditof::Status setSensorConfiguration(const std::string &sensorConf) override
Set sensor configutation table.
Definition: usb_depth_sensor_linux.cpp:1039
aditof::DepthSensorModeDetails
Describes the type of entire frame that a depth sensor can capture and transmit.
Definition: sensor_definitions.h:120
UsbDepthSensor::stop
virtual aditof::Status stop() override
Stop the sensor data stream.
Definition: usb_depth_sensor_linux.cpp:219
UsbDepthSensor::m_sensorName
std::string m_sensorName
Definition: usb_depth_sensor.h:110
usb_utils.h
UsbDepthSensor::ImplData::calibration_cache
std::unordered_map< std::string, CalibrationData > calibration_cache
Definition: usb_depth_sensor_linux.cpp:71
UsbDepthSensor::getModeDetails
virtual aditof::Status getModeDetails(const uint8_t &mode, aditof::DepthSensorModeDetails &details) override
Returns details of specified mode.
Definition: usb_depth_sensor_linux.cpp:251
r
GLboolean r
Definition: glcorearb.h:3228
CalibrationData::offset
float offset
Definition: network_depth_sensor.cpp:46
strerror
char * strerror(int errno)
CalibrationData::mode
std::string mode
Definition: network_depth_sensor.cpp:44
UsbDepthSensor::adsd3500_read_payload_cmd
virtual aditof::Status adsd3500_read_payload_cmd(uint32_t cmd, uint8_t *readback_data, uint16_t payload_len) override
Send a read command to adsd3500. This will perform a burst read making it useful for reading chunks o...
Definition: usb_depth_sensor_linux.cpp:765
UsbLinuxUtils::uvcExUnitGetResponse
static aditof::Status uvcExUnitGetResponse(int fd, std::string &responseStr)
Get the response (which is encoded in a protobuf message) for the last request that was made....
Definition: usb_linux_utils.cpp:343
UsbDepthSensor::getDepthComputeParams
virtual aditof::Status getDepthComputeParams(std::map< std::string, std::string > &params) override
Get ini parameters for Depth Compute library.
Definition: usb_depth_sensor_linux.cpp:1024
aditof::GET_AVAILABLE_CONTROLS
@ GET_AVAILABLE_CONTROLS
Definition: gpio.h:50
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: glcorearb.h:2879
UsbDepthSensor::ImplData
Definition: usb_depth_sensor_linux.cpp:64
aditof::SensorDetails::connectionType
ConnectionType connectionType
The type of connection with the sensor.
Definition: sensor_definitions.h:60
UsbDepthSensor::ImplData::opened
bool opened
Definition: usb_depth_sensor_linux.cpp:69
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
UsbDepthSensor::UsbDepthSensor
UsbDepthSensor(const std::string &name, const std::string &driverPath)
Definition: usb_depth_sensor_linux.cpp:74
aditof::SET_MODE
@ SET_MODE
Definition: gpio.h:47
UsbLinuxUtils::xioctl
static int xioctl(int fh, unsigned long request, void *arg)
Definition: usb_linux_utils.cpp:54
UsbLinuxUtils::uvcExUnitSendRequest
static aditof::Status uvcExUnitSendRequest(int fd, const std::string &requestStr)
Send a request (which is encoded in a protobuf message) via the UVC extension unit.
Definition: usb_linux_utils.cpp:302
UsbDepthSensor::ImplData::buffersCount
unsigned int buffersCount
Definition: usb_depth_sensor_linux.cpp:67
UsbDepthSensor::m_sensorDetails
aditof::SensorDetails m_sensorDetails
Definition: usb_depth_sensor.h:112
UsbDepthSensor::setControl
virtual aditof::Status setControl(const std::string &control, const std::string &value) override
Sets a specific sensor control.
Definition: usb_depth_sensor_linux.cpp:550
it
MapIter it
Definition: php/ext/google/protobuf/map.c:205
aditof::SensorInterruptCallback
std::function< void(Adsd3500Status)> SensorInterruptCallback
Callback for sensor interrupts.
Definition: depth_sensor_interface.h:50


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:01