From 40058ef9bb1b2beaf2f764e9b6f605e9ff679b77 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 13:16:06 +0200 Subject: tracker/steamvr: expose all valid devices --- tracker-steamvr/steamvr.cpp | 13 ++++++++++--- tracker-steamvr/steamvr.hpp | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'tracker-steamvr') diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index d32c9d44..43bccdb8 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -55,16 +55,21 @@ void device_list::fill_device_specs(QList& list) device_states, vr::k_unMaxTrackedDeviceCount); static constexpr unsigned bufsiz = vr::k_unTrackingStringSize; - static char str[bufsiz] {}; // vr_lock prevents reentrancy + static char str[bufsiz+1] {}; // vr_lock prevents reentrancy for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++) { - if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid || - v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference) + if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid) + { + qDebug() << "no device with index"; continue; + } if (!device_states[k].bDeviceIsConnected) + { + qDebug() << "device not connected but proceeding"; continue; + } unsigned len; @@ -92,6 +97,8 @@ void device_list::fill_device_specs(QList& list) dev.type = "HMD"; break; case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: dev.type = "Controller"; break; + case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: + dev.type = "Tracker"; break; default: dev.type = "Unknown"; break; } diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index e979b9e3..721fded7 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -81,7 +81,7 @@ public: bool center() override; private: - static void matrix_to_euler(double &yaw, double &pitch, double &roll, const vr::HmdMatrix34_t& result); + static void matrix_to_euler(double& yaw, double& pitch, double& roll, const vr::HmdMatrix34_t& result); settings s; int device_index; -- cgit v1.2.3