Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions etee/resources/settings/default.vrsettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"driver_etee": {
"left_enabled": true,
"right_enabled": true,
"reload_pose": false,
"override_serial_port": false,
"serial_port": 2
},
Expand Down
1 change: 1 addition & 0 deletions include/ControllerPose.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ControllerPose {

void SetShadowEteeTracker(short deviceId, bool isRightHand);
void SetAdaptorIsConnected(bool adaptorConnected, bool isRight);
void RediscoverTrackedDevice();

private:
void DiscoverTrackedDevice();
Expand Down
2 changes: 2 additions & 0 deletions include/DeviceDriver/EteeDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class EteeDeviceDriver : public IDeviceDriver {

VRControllerState GetControllerState();

void RediscoverTrackedDevice();

private:
void StartDevice();
bool IsRightHand() const;
Expand Down
1 change: 1 addition & 0 deletions include/DeviceProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DeviceProvider : public vr::IServerTrackedDeviceProvider {
void HandleDongleStateUpdate(VRDongleState dongleState);
void HandleControllerStateUpdate(VRHandedControllerState_t controllerState);
void HandleDeviceEvent(const vr::ETrackedControllerRole role, const DeviceEvent& event);
void HandleDriverSettingsChange();

VRDeviceConfiguration m_leftConfiguration{};
VRDeviceConfiguration m_rightConfiguration{};
Expand Down
5 changes: 5 additions & 0 deletions src/ControllerPose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ ControllerPose::ControllerPose(VRPoseConfiguration configuration)
m_eteeTrackerThruRole(false), // Disable assignment of role through SVR Manage Trackers, use auto-hand-assignment
m_state(){};

void ControllerPose::RediscoverTrackedDevice() {
DriverLog("Rediscovering tracked devices");
m_shadowTrackerId = -1;
}

void ControllerPose::DiscoverTrackedDevice() {
if (m_eteeTrackerConnected) return;

Expand Down
4 changes: 4 additions & 0 deletions src/DeviceDriver/EteeDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ VRControllerState EteeDeviceDriver::GetControllerState() {
return m_deviceState;
}

void EteeDeviceDriver::RediscoverTrackedDevice() {
m_controllerPose->RediscoverTrackedDevice();
}

void EteeDeviceDriver::Deactivate() {
if (m_isActive.exchange(false)) {
m_poseUpdateThread.join();
Expand Down
14 changes: 14 additions & 0 deletions src/DeviceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,23 @@ const char* const* DeviceProvider::GetInterfaceVersions() {
return vr::k_InterfaceVersions;
}

void DeviceProvider::HandleDriverSettingsChange() {
if (vr::VRSettings()->GetBool(c_driverSettingsSection, "reload_pose")) {
vr::VRSettings()->SetBool(c_driverSettingsSection, "reload_pose", false);

if (m_leftHand != nullptr && m_leftHand->IsActive()) m_leftHand->RediscoverTrackedDevice();
if (m_rightHand != nullptr && m_rightHand->IsActive()) m_rightHand->RediscoverTrackedDevice();
}
}

void DeviceProvider::RunFrame() {
vr::VREvent_t pEvent{};
while (vr::VRServerDriverHost()->PollNextEvent(&pEvent, sizeof(pEvent))) {
if (pEvent.eventType == vr::VREvent_AnyDriverSettingsChanged) {
HandleDriverSettingsChange();
continue;
}

if (m_leftHand != nullptr && m_leftHand->IsActive()) m_leftHand->OnVREvent(pEvent);
if (m_rightHand != nullptr && m_rightHand->IsActive()) m_rightHand->OnVREvent(pEvent);
}
Expand Down