Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update openvr to latest stable 1.0.5 #26

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 7 additions & 0 deletions OSVRViveTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,13 @@ namespace vive {
<< unWhichDevice << std::endl;
}
break;
case vr::TrackedProp_PermissionDenied:
/// Refused to give us an update because of permission
std::cout << "error: TrackedProp_PermissionDenied when getting "
"universe ID from "
<< unWhichDevice << std::endl;
return;
break;
default:
std::cout << "Got unrecognized error " << err
<< " when getting universe ID from " << unWhichDevice
Expand Down
32 changes: 7 additions & 25 deletions PropertyHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ namespace vive {
assert(dev != nullptr &&
"Tried to get a string property from a null device "
"pointer.");
static const auto INITIAL_BUFFER_SIZE =
vr::k_unTrackingStringSize;
/// Start with a buffer of k_unTrackingStringSize as suggested.
std::vector<char> buf(INITIAL_BUFFER_SIZE, '\0');

/// Get a buffer of max string size
std::vector<char> buf(vr::k_unMaxPropertyStringSize, '\0');
vr::ETrackedPropertyError err = vr::TrackedProp_Success;
auto ret = dev->GetStringTrackedDeviceProperty(
args..., prop, buf.data(),
Expand All @@ -155,32 +154,15 @@ namespace vive {
}

if (ret > buf.size()) {
/// received a buffer greater than 32768 chars, which should
/// not happen
std::cout
<< "[getStringProperty] Got an initial return value "
"larger than the buffer size: ret = "
<< ret << ", buf.size() = " << buf.size() << std::endl;
}
if (vr::TrackedProp_BufferTooSmall == err) {
// first buffer was too small, but now we know how big it
// should be, per the docs.
/// @todo remove this debug print
std::cout << "[getStringProperty] Initial buffer size: "
<< buf.size() << ", return value: " << ret
<< std::endl;
buf.resize(ret + 1, '\0');
ret = dev->GetStringTrackedDeviceProperty(
args..., prop, buf.data(),
static_cast<uint32_t>(buf.size()), &err);
}

if (ret > buf.size()) {
std::cout
<< "[getStringProperty] THIS SHOULDN'T HAPPEN: Got a "
<< "[getStringProperty] THAT SHOULD NOT HAPPEN Got a "
"return value larger than the buffer size: ret = "
<< ret << ", buf.size() = " << buf.size() << std::endl;

return std::make_pair(std::string{}, err);
}

return std::make_pair(std::string{buf.data()}, err);
}
};
Expand Down
63 changes: 62 additions & 1 deletion PropertyTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace vive {
DriverVersion = vr::Prop_DriverVersion_String,
Firmware_ForceUpdateRequired =
vr::Prop_Firmware_ForceUpdateRequired_Bool,
ViveSystemButtonFixRequired = vr::Prop_ViveSystemButtonFixRequired_Bool,
ReportsTimeSinceVSync = vr::Prop_ReportsTimeSinceVSync_Bool,
SecondsFromVsyncToPhotons = vr::Prop_SecondsFromVsyncToPhotons_Float,
DisplayFrequency = vr::Prop_DisplayFrequency_Float,
Expand Down Expand Up @@ -131,6 +132,7 @@ namespace vive {
ScreenshotVerticalFieldOfViewDegrees =
vr::Prop_ScreenshotVerticalFieldOfViewDegrees_Float,
DisplaySuppressed = vr::Prop_DisplaySuppressed_Bool,
DisplayAllowNightMode = vr::Prop_DisplayAllowNightMode_Bool,
AttachedDeviceId = vr::Prop_AttachedDeviceId_String,
SupportedButtons = vr::Prop_SupportedButtons_Uint64,
Axis0Type = vr::Prop_Axis0Type_Int32,
Expand All @@ -144,7 +146,21 @@ namespace vive {
FieldOfViewBottomDegrees = vr::Prop_FieldOfViewBottomDegrees_Float,
TrackingRangeMinimumMeters = vr::Prop_TrackingRangeMinimumMeters_Float,
TrackingRangeMaximumMeters = vr::Prop_TrackingRangeMaximumMeters_Float,
ModeLabel = vr::Prop_ModeLabel_String
ModeLabel = vr::Prop_ModeLabel_String,
IconPathName = vr::Prop_IconPathName_String,
NamedIconPathDeviceOff = vr::Prop_NamedIconPathDeviceOff_String,
NamedIconPathDeviceSearching =
vr::Prop_NamedIconPathDeviceSearching_String,
NamedIconPathDeviceSearchingAlert =
vr::Prop_NamedIconPathDeviceSearchingAlert_String,
NamedIconPathDeviceReady = vr::Prop_NamedIconPathDeviceReady_String,
NamedIconPathDeviceReadyAlert =
vr::Prop_NamedIconPathDeviceReadyAlert_String,
NamedIconPathDeviceNotReady =
vr::Prop_NamedIconPathDeviceNotReady_String,
NamedIconPathDeviceStandby = vr::Prop_NamedIconPathDeviceStandby_String,
NamedIconPathDeviceAlertLow =
vr::Prop_NamedIconPathDeviceAlertLow_String
};
namespace detail {
template <std::size_t EnumVal> struct PropertyTypeTrait;
Expand Down Expand Up @@ -267,6 +283,10 @@ namespace vive {
using type = bool;
};
template <>
struct PropertyTypeTrait<vr::Prop_ViveSystemButtonFixRequired_Bool> {
using type = bool;
};
template <>
struct PropertyTypeTrait<vr::Prop_ReportsTimeSinceVSync_Bool> {
using type = bool;
};
Expand Down Expand Up @@ -398,6 +418,10 @@ namespace vive {
template <> struct PropertyTypeTrait<vr::Prop_DisplaySuppressed_Bool> {
using type = bool;
};
template <>
struct PropertyTypeTrait<vr::Prop_DisplayAllowNightMode_Bool> {
using type = bool;
};
template <> struct PropertyTypeTrait<vr::Prop_AttachedDeviceId_String> {
using type = std::string;
};
Expand Down Expand Up @@ -446,6 +470,43 @@ namespace vive {
template <> struct PropertyTypeTrait<vr::Prop_ModeLabel_String> {
using type = std::string;
};
template <> struct PropertyTypeTrait<vr::Prop_IconPathName_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceOff_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceSearching_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<
vr::Prop_NamedIconPathDeviceSearchingAlert_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceReady_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<
vr::Prop_NamedIconPathDeviceReadyAlert_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceNotReady_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceStandby_String> {
using type = std::string;
};
template <>
struct PropertyTypeTrait<vr::Prop_NamedIconPathDeviceAlertLow_String> {
using type = std::string;
};
} // namespace detail

} // namespace vive
Expand Down
5 changes: 5 additions & 0 deletions ServerDriverHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,8 @@ bool ServerDriverHost::IsExiting() {
LOG_EVENTS("IsExiting()");
return isExiting_;
}

bool ServerDriverHost::PollNextEvent(VREvent_t *pEvent, uint32_t uncbVREvent) {
LOG_EVENTS("PollNextEvent()");
return false;
}
2 changes: 2 additions & 0 deletions ServerDriverHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class ServerDriverHost : public vr::IServerDriverHost {

virtual bool IsExiting();

virtual bool PollNextEvent(VREvent_t *pEvent, uint32_t uncbVREvent);

IVRSettings *vrSettings = nullptr;

private:
Expand Down
14 changes: 6 additions & 8 deletions VRSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ bool VRSettings::Sync(bool bForce, EVRSettingsError *peError) {
}

bool VRSettings::GetBool(const char *pchSection, const char *pchSettingsKey,
bool bDefaultValue, EVRSettingsError *peError) {
EVRSettingsError *peError) {
LOG_EVENTS("GetBool(" << pchSection << ", " << pchSettingsKey << ", "
<< bDefaultValue << ", " << peError << ")");
<< peError << ")");
// return true for now
return true;
}
Expand All @@ -81,9 +81,9 @@ void VRSettings::SetInt32(const char *pchSection, const char *pchSettingsKey,
}

float VRSettings::GetFloat(const char *pchSection, const char *pchSettingsKey,
float flDefaultValue, EVRSettingsError *peError) {
EVRSettingsError *peError) {
LOG_EVENTS("SetInt32(" << pchSection << ", " << pchSettingsKey << ", "
<< flDefaultValue << ", " << peError << ")");
<< peError << ")");
return 67.0;
}

Expand All @@ -94,11 +94,9 @@ void VRSettings::SetFloat(const char *pchSection, const char *pchSettingsKey,
}

void GetString(const char *pchSection, const char *pchSettingsKey,
char *pchValue, uint32_t unValueLen, const char *pchDefaultValue,
EVRSettingsError *peError) {
char *pchValue, uint32_t unValueLen, EVRSettingsError *peError) {
LOG_EVENTS("SetInt32(" << pchSection << ", " << pchSettingsKey << ", "
<< unValueLen << ", " << pchDefaultValue << ", "
<< peError << ")");
<< unValueLen << ", " << peError << ")");
}

void VRSettings::SetString(const char *pchSection, const char *pchSettingsKey,
Expand Down
4 changes: 0 additions & 4 deletions VRSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class VRSettings : public IVRSettings {
virtual bool Sync(bool bForce = false, EVRSettingsError *peError = nullptr);

virtual bool GetBool(const char *pchSection, const char *pchSettingsKey,
bool bDefaultValue,
EVRSettingsError *peError = nullptr);
virtual void SetBool(const char *pchSection, const char *pchSettingsKey,
bool bValue, EVRSettingsError *peError = nullptr);
Expand All @@ -54,18 +53,15 @@ class VRSettings : public IVRSettings {
virtual void SetInt32(const char *pchSection, const char *pchSettingsKey,
int32_t nValue, EVRSettingsError *peError = nullptr);
virtual float GetFloat(const char *pchSection, const char *pchSettingsKey,
float flDefaultValue,
EVRSettingsError *peError = nullptr);
virtual void SetFloat(const char *pchSection, const char *pchSettingsKey,
float flValue, EVRSettingsError *peError = nullptr);
virtual void GetString(const char *pchSection, const char *pchSettingsKey,
char *pchValue, uint32_t unValueLen,
const char *pchDefaultValue,
EVRSettingsError *peError = nullptr);
virtual void SetString(const char *pchSection, const char *pchSettingsKey,
const char *pchValue,
EVRSettingsError *peError = nullptr);

virtual void RemoveSection(const char *pchSection,
EVRSettingsError *peError = nullptr);
virtual void RemoveKeyInSection(const char *pchSection,
Expand Down
2 changes: 1 addition & 1 deletion vendor/openvr
Submodule openvr updated 77 files
+6 −2 README.md
+ bin/linux32/libopenvr_api.so
+ bin/linux32/libopenvr_api.so.dbg
+ bin/linux64/libopenvr_api.so
+ bin/linux64/libopenvr_api.so.dbg
+ bin/osx32/libopenvr_api.dylib
+ bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylib
+ bin/win32/openvr_api.dll
+ bin/win32/openvr_api.pdb
+ bin/win64/openvr_api.dll
+ bin/win64/openvr_api.pdb
+ controller_callouts/Callouts.eps
+ controller_callouts/Callouts.pdf
+295 −80 headers/openvr.h
+288 −90 headers/openvr_api.cs
+253 −67 headers/openvr_api.json
+167 −35 headers/openvr_capi.h
+162 −66 headers/openvr_driver.h
+ lib/linux32/libopenvr_api.so
+ lib/linux64/libopenvr_api.so
+ lib/win32/openvr_api.lib
+ lib/win64/openvr_api.lib
+213 −0 samples/CMakeLists.txt
+70 −0 samples/README.md
+ samples/bin/linux64/libopenvr_api.so
+ samples/bin/osx32/libopenvr_api.dylib
+ samples/bin/win32/openvr_api.dll
+ samples/bin/win64/openvr_api.dll
+16 −0 samples/driver_sample/CMakeLists.txt
+21 −17 samples/driver_sample/driver_sample.cpp
+16 −0 samples/hellovr_opengl/CMakeLists.txt
+109 −205 samples/hellovr_opengl/hellovr_opengl_main.cpp
+28 −0 samples/helloworldoverlay/CMakeLists.txt
+1 −0 samples/helloworldoverlay/helloworldoverlay.pro
+1 −0 samples/helloworldoverlay/openvroverlaycontroller.h
+27 −0 samples/shared/compat.h
+26 −0 samples/tracked_camera_openvr_sample/CMakeLists.txt
+2 −0 samples/tracked_camera_openvr_sample/tracked_camera_openvr_sample.cpp
+14 −0 src/CMakeLists.txt
+35 −0 src/README
+35 −0 src/ivrclientcore.h
+284 −0 src/json/json-forwards.h
+2,077 −0 src/json/json.h
+5,266 −0 src/jsoncpp.cpp
+278 −0 src/openvr_api_public.cpp
+17 −0 src/vrcommon/dirtools.h
+100 −0 src/vrcommon/dirtools_public.cpp
+7 −0 src/vrcommon/envvartools.h
+46 −0 src/vrcommon/envvartools_public.cpp
+8 −0 src/vrcommon/hmderrors.h
+204 −0 src/vrcommon/hmderrors_public.cpp
+129 −0 src/vrcommon/pathtools.h
+817 −0 src/vrcommon/pathtools_public.cpp
+10 −0 src/vrcommon/sharedlibtools.h
+41 −0 src/vrcommon/sharedlibtools_public.cpp
+126 −0 src/vrcommon/strtools.h
+437 −0 src/vrcommon/strtools_public.cpp
+46 −0 src/vrcommon/vrpathregistry.h
+406 −0 src/vrcommon/vrpathregistry_public.cpp
+288 −90 unity_package/Assets/Plugins/openvr_api.cs
+1 −1 unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs
+0 −33 unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.unity
+55 −163 unity_package/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity
+1 −1 unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs
+11 −4 unity_package/Assets/SteamVR/Scripts/SteamVR.cs
+1 −1 unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs
+2 −2 unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs
+1 −1 unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs
+2 −2 unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs
+1 −1 unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs
+3 −3 unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs
+1 −1 unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs
+14 −14 unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs
+1 −1 unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs
+2 −2 unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedCamera.cs
+683 −681 unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs
+24 −1 unity_package/Assets/SteamVR/readme.txt