Skip to content

Commit 6b369ec

Browse files
committed
Filter out tracking reference devices (e.g. SteamVR Base Stations)
1 parent bc53367 commit 6b369ec

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/VRDriver.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,10 @@ void SlimeVRDriver::VRDriver::RunPoseRequestThread() {
146146
vr::PropertyContainerHandle_t prop_container = vr::VRProperties()->TrackedDeviceToPropertyContainer(index);
147147
messages::ProtobufMessage* message = google::protobuf::Arena::CreateMessage<messages::ProtobufMessage>(&arena_);
148148

149-
// Don't feed data about our own trackers, or Standable's fake ones.
150149
{
151150
vr::ETrackedPropertyError error{};
151+
152+
// Don't feed data about our own trackers and Standable's fake ones
152153
auto driver_name = vr::VRProperties()->GetStringProperty(prop_container, vr::Prop_TrackingSystemName_String, &error);
153154
if (error != vr::TrackedProp_Success) {
154155
if (error != vr::TrackedProp_InvalidDevice && error != vr::TrackedProp_UnknownProperty)
@@ -157,6 +158,17 @@ void SlimeVRDriver::VRDriver::RunPoseRequestThread() {
157158
continue;
158159
}
159160
if (driver_name == "slimevr" || driver_name == "standable") continue;
161+
162+
auto device_class = (vr::ETrackedDeviceClass)vr::VRProperties()->GetInt32Property(prop_container, vr::Prop_DeviceClass_Int32, &error);
163+
if (error != vr::TrackedProp_Success) {
164+
logger_->Log("Failed to get Prop_DeviceClass_Int32 for device {}: {}", index, vr::VRPropertiesRaw()->GetPropErrorNameFromEnum(error));
165+
continue;
166+
}
167+
168+
// Ignore devices that aren't HMD, controllers, or generic trackers
169+
if (device_class == vr::TrackedDeviceClass_Invalid || device_class >= vr::TrackedDeviceClass_TrackingReference) {
170+
continue;
171+
}
160172
}
161173

162174
if (device.sent_add_message && !pose.bDeviceIsConnected) {

0 commit comments

Comments
 (0)