Skip to content

linux compile shared lib #9

@frostworx

Description

@frostworx

hi,
just stumbled over this upcoming arduino vr project https://www.reddit.com/r/SteamVR/comments/g30lng/arduino_index_controllers_free_head_tracking/
(auther says it will be opensource) and regarding linux compatibility he mentioned your soft_knuckles.
I had to make some minor modifications in order to build your code under linux:

Prop_LegacyInputProfile_String is deprecated so I replaced it with Prop_InputProfilePath_String in soft_knuckles_device.cpp. no idea if this is correct:

--- soft_knuckles_device.cpp	2020-04-18 10:32:44.671686051 +0200
+++ soft_knuckles_device.cpp	2020-04-18 10:18:10.197399235 +0200
@@ -326,7 +326,7 @@
     SetInt32Property(Prop_DeviceClass_Int32, (int32_t)TrackedDeviceClass_Controller);
     SetProperty(Prop_InputProfilePath_String, "{soft_knuckles}/input/soft_knuckles_profile.json");
     SetProperty(Prop_ControllerType_String, "soft_knuckles");
-    SetProperty(Prop_LegacyInputProfile_String, "soft_knuckles");
+    SetProperty(Prop_InputProfilePath_String, "soft_knuckles");
 
     m_component_handles.resize(m_num_component_definitions);
     for (uint32_t i = 0; i < m_num_component_definitions; i++)

WatchdogWakeUp requires an argument now, so this change was required in soft_knuckles_provider.cpp:

--- soft_knuckles_provider.cpp	2020-04-18 10:34:41.931552083 +0200
+++ soft_knuckles_provider.cpp	2020-04-18 10:20:06.928803669 +0200
@@ -181,7 +181,7 @@
 #else
         // for the other platforms, just send one every five seconds
         this_thread::sleep_for(chrono::seconds(5));
-        vr::VRWatchdogHost()->WatchdogWakeUp();
+        vr::VRWatchdogHost()->WatchdogWakeUp(vr::TrackedDeviceClass_HMD);
 #endif
     }
 }

the bundled make_linux.sh just builds the objects but doesn't link a shared lib, so I created a quick&dirty (hardcoded openvr header path) CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(soft_knuckles)
INCLUDE_DIRECTORIES( "/usr/include/openvr" )
SET(SNSRC
	dprintf.cpp
	socket_notifier.cpp 
	soft_knuckles_config.cpp 
	soft_knuckles_debug_handler.cpp 
	soft_knuckles_device.cpp 
	soft_knuckles_provider.cpp 
	)

add_library(
	soft_knuckles
	SHARED
	${SNSRC}
)

builds fine here and creates a libsoft_knuckles.so
haven't tested the result, but maybe it is of some use :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions