aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoshua Allen <axlecrusher@gmail.com>2017-03-18 20:23:40 -0400
committerJoshua Allen <axlecrusher@gmail.com>2017-03-18 20:23:40 -0400
commit079ef4516edee08da8a129a0d84249ccb79bbf23 (patch)
tree9e7b109a98957526ceca63b0ddd07fc96f8697a6 /src
parent4e3ac12016cc489c818709412acd293cac54cb78 (diff)
parent0f94e39d96fbc2744e61b85d2884250d0783eb11 (diff)
downloadlibsurvive-079ef4516edee08da8a129a0d84249ccb79bbf23.tar.gz
libsurvive-079ef4516edee08da8a129a0d84249ccb79bbf23.tar.bz2
Merge branch 'master' of github.com:cnlohr/libsurvive
Diffstat (limited to 'src')
-rwxr-xr-xsrc/survive_cal.c3
-rw-r--r--src/survive_cal.h4
-rw-r--r--src/survive_data.c24
-rwxr-xr-xsrc/survive_vive.c149
4 files changed, 141 insertions, 39 deletions
diff --git a/src/survive_cal.c b/src/survive_cal.c
index 0eb9446..9dc3af2 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -272,6 +272,7 @@ void survive_cal_angle( struct SurviveObject * so, int sensor_id, int acode, uin
if( sensors_visible < MIN_SENSORS_VISIBLE_PER_LH_FOR_CAL )
{
//printf( "Dev %d, LH %d not enough visible points found.\n", i, j );
+ reset_calibration( cd );
cd->found_common = 0;
return;
}
@@ -440,7 +441,7 @@ static void handle_calibration( struct SurviveCalData *cd )
FLT stddevlen = 0;
#define HISTOGRAMSIZE 31
- #define HISTOGRAMBINANG 0.00001 //TODO: Tune
+ #define HISTOGRAMBINANG ((3.14159)/400000.0) //TODO: Tune
int histo[HISTOGRAMSIZE];
memset( histo, 0, sizeof( histo ) );
diff --git a/src/survive_cal.h b/src/survive_cal.h
index 3d62051..701dc60 100644
--- a/src/survive_cal.h
+++ b/src/survive_cal.h
@@ -35,7 +35,9 @@ void survive_cal_angle( SurviveObject * so, int sensor_id, int acode, uint32_t t
#define MAX_SENSORS_TO_CAL 96
#define MIN_PTS_BEFORE_CAL 24
-#define DRPTS 128
+
+
+#define DRPTS 1024 //Number of samples required in collection phase.
#define POSE_OBJECTS 3
diff --git a/src/survive_data.c b/src/survive_data.c
index d658e18..16a22e9 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -21,17 +21,31 @@ int32_t decode_acode(uint32_t length, int32_t main_divisor) {
//This is the disambiguator function, for taking light timing and figuring out place-in-sweep for a given photodiode.
void handle_lightcap( SurviveObject * so, LightcapElement * le )
{
- SurviveContext * ctx = so->ctx;
+ SurviveContext * ctx = so->ctx;
//int32_t deltat = (uint32_t)le->timestamp - (uint32_t)so->last_master_time;
- //if( so->codename[0] != 'H' )
-
-
if( le->sensor_id > SENSORS_PER_OBJECT )
{
return;
}
+#if 0
+ if( so->codename[0] == 'H' )
+ {
+ static int lt;
+ static int last;
+ if( le->length > 1000 )
+ {
+ int dl = le->timestamp - lt;
+ lt = le->timestamp;
+ if( dl > 10000 || dl < -10000 )
+ printf( "+++%s %3d %5d %9d ", so->codename, le->sensor_id, le->length, dl );
+ if( dl > 100000 ) printf(" \n" );
+ }
+ last=le->length;
+ }
+#endif
+
so->tsl = le->timestamp;
if( le->length < 20 ) return; ///Assuming 20 is an okay value for here.
@@ -57,7 +71,7 @@ void handle_lightcap( SurviveObject * so, LightcapElement * le )
{
int is_new_pulse = delta > so->pulselength_min_sync /*1500*/ + last_sync_length;
-// printf("m sync %d %d %d %d\n", le->sensor_id, so->last_sync_time[ssn], le->timestamp, delta);
+ //printf("m sync %d %d %d %d\n", le->sensor_id, so->last_sync_time[ssn], le->timestamp, delta);
so->did_handle_ootx = 0;
diff --git a/src/survive_vive.c b/src/survive_vive.c
index cdc319d..f6465b2 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -39,13 +39,15 @@
struct SurviveViveData;
const short vidpids[] = {
- 0x0bb4, 0x2c87, 0, //The main HTC HMD device
- 0x28de, 0x2000, 0, //Valve lighthouse
+ 0x0bb4, 0x2c87, 0, //Valve HMD Button and face proximity sensor
+ 0x28de, 0x2000, 0, //Valve HMD IMU & Lighthouse Sensors
0x28de, 0x2101, 0, //Valve Watchman
0x28de, 0x2101, 1, //Valve Watchman
0x28de, 0x2022, 0, //HTC Tracker
+ 0x28de, 0x2012, 0, //Valve Watchman, USB connected
#ifdef HIDAPI
- 0x28de, 0x2000, 1, //Valve lighthouse(B) (only used on HIDAPI, for lightcap)
+ 0x28de, 0x2000, 1, //Valve HMD lighthouse(B) (only used on HIDAPI, for lightcap)
+ 0x28de, 0x2012, 1, //Valve Watchman, USB connected (only used on HIDAPI, for lightcap)
#endif
}; //length MAX_USB_INTERFACES*2
@@ -55,8 +57,10 @@ const char * devnames[] = {
"Watchman 1",
"Watchman 2",
"Tracker 0",
+ "Wired Watchman 1",
#ifdef HIDAPI
- "Lightcap",
+ "HMD Lightcap",
+ "Wired Watchman 1 Lightcap",
#endif
}; //length MAX_USB_INTERFACES
@@ -66,12 +70,14 @@ const char * devnames[] = {
#define USB_DEV_WATCHMAN1 2
#define USB_DEV_WATCHMAN2 3
#define USB_DEV_TRACKER0 4
+#define USB_DEV_W_WATCHMAN1 5 // Wired Watchman attached via USB
#ifdef HIDAPI
-#define USB_DEV_LIGHTHOUSEB 5
-#define MAX_USB_DEVS 6
+#define USB_DEV_LIGHTHOUSEB 6
+#define USB_DEV_W_WATCHMAN1_LIGHTCAP 7
+#define MAX_USB_DEVS 8
#else
-#define MAX_USB_DEVS 5
+#define MAX_USB_DEVS 6
#endif
#define USB_IF_HMD 0
@@ -79,8 +85,10 @@ const char * devnames[] = {
#define USB_IF_WATCHMAN1 2
#define USB_IF_WATCHMAN2 3
#define USB_IF_TRACKER0 4
-#define USB_IF_LIGHTCAP 5
-#define MAX_INTERFACES 6
+#define USB_IF_W_WATCHMAN1 5
+#define USB_IF_LIGHTCAP 6
+#define USB_IF_W_WATCHMAN1_LIGHTCAP 7
+#define MAX_INTERFACES 8
typedef struct SurviveUSBInterface SurviveUSBInterface;
typedef struct SurviveViveData SurviveViveData;
@@ -133,10 +141,10 @@ void survive_data_cb( SurviveUSBInterface * si );
//USB Subsystem
void survive_usb_close( SurviveContext * t );
-int survive_usb_init( SurviveViveData * sv, SurviveObject * hmd, SurviveObject *wm0, SurviveObject * wm1, SurviveObject * tr0 );
+int survive_usb_init( SurviveViveData * sv, SurviveObject * hmd, SurviveObject *wm0, SurviveObject * wm1, SurviveObject * tr0 , SurviveObject * ww0 );
int survive_usb_poll( SurviveContext * ctx );
int survive_get_config( char ** config, SurviveViveData * ctx, int devno, int iface, int send_extra_magic );
-int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_code, void * data, int datalen );
+int survive_vive_send_magic(SurviveContext * ctx, void * drv, int magic_code, void * data, int datalen );
#ifdef HIDAPI
void * HAPIReceiver( void * v )
@@ -169,8 +177,8 @@ void * HAPIReceiver( void * v )
#else
static void handle_transfer(struct libusb_transfer* transfer)
{
- struct SurviveUSBInterface * iface = transfer->user_data;
- struct SurviveContext * ctx = iface->ctx;
+ SurviveUSBInterface * iface = transfer->user_data;
+ SurviveContext * ctx = iface->ctx;
if( transfer->status != LIBUSB_TRANSFER_COMPLETED )
{
@@ -299,9 +307,9 @@ static inline int hid_get_feature_report_timeout(USBHANDLE device, uint16_t ifac
return -1;
}
-int survive_usb_init( struct SurviveViveData * sv, struct SurviveObject * hmd, struct SurviveObject *wm0, struct SurviveObject * wm1, struct SurviveObject * tr0 )
+int survive_usb_init( SurviveViveData * sv, SurviveObject * hmd, SurviveObject *wm0, SurviveObject * wm1, SurviveObject * tr0 , SurviveObject * ww0 )
{
- struct SurviveContext * ctx = sv->ctx;
+ SurviveContext * ctx = sv->ctx;
#ifdef HIDAPI
if( !GlobalRXUSBMutx )
{
@@ -463,11 +471,14 @@ int survive_usb_init( struct SurviveViveData * sv, struct SurviveObject * hmd, s
if( sv->udev[USB_DEV_WATCHMAN1] && AttachInterface( sv, wm0, USB_IF_WATCHMAN1, sv->udev[USB_DEV_WATCHMAN1], 0x81, survive_data_cb, "Watchman 1" ) ) { return -8; }
if( sv->udev[USB_DEV_WATCHMAN2] && AttachInterface( sv, wm1, USB_IF_WATCHMAN2, sv->udev[USB_DEV_WATCHMAN2], 0x81, survive_data_cb, "Watchman 2")) { return -9; }
if( sv->udev[USB_DEV_TRACKER0] && AttachInterface( sv, tr0, USB_IF_TRACKER0, sv->udev[USB_DEV_TRACKER0], 0x81, survive_data_cb, "Tracker 1")) { return -10; }
+ if( sv->udev[USB_DEV_W_WATCHMAN1] && AttachInterface( sv, ww0, USB_IF_W_WATCHMAN1, sv->udev[USB_DEV_W_WATCHMAN1], 0x81, survive_data_cb, "Wired Watchman 1")) { return -11; }
#ifdef HIDAPI
//Tricky: use other interface for actual lightcap. XXX THIS IS NOT YET RIGHT!!!
if( sv->udev[USB_DEV_LIGHTHOUSEB] && AttachInterface( sv, hmd, USB_IF_LIGHTCAP, sv->udev[USB_DEV_LIGHTHOUSEB], 0x82, survive_data_cb, "Lightcap")) { return -12; }
+ if( sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP] && AttachInterface( sv, ww0, USB_IF_W_WATCHMAN1_LIGHTCAP, sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP], 0x82, survive_data_cb, "Wired Watchman 1 Lightcap")) { return -13; }
#else
if( sv->udev[USB_DEV_LIGHTHOUSE] && AttachInterface( sv, hmd, USB_IF_LIGHTCAP, sv->udev[USB_DEV_LIGHTHOUSE], 0x82, survive_data_cb, "Lightcap")) { return -12; }
+ if( sv->udev[USB_DEV_W_WATCHMAN1] && AttachInterface( sv, ww0, USB_IF_W_WATCHMAN1_LIGHTCAP, sv->udev[USB_DEV_W_WATCHMAN1], 0x82, survive_data_cb, "Wired Watchman 1 Lightcap")) { return -13; }
#endif
SV_INFO( "All enumerated devices attached." );
@@ -477,10 +488,10 @@ int survive_usb_init( struct SurviveViveData * sv, struct SurviveObject * hmd, s
return 0;
}
-int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_code, void * data, int datalen )
+int survive_vive_send_magic(SurviveContext * ctx, void * drv, int magic_code, void * data, int datalen )
{
int r;
- struct SurviveViveData * sv = drv;
+ SurviveViveData * sv = drv;
printf( "*CALLING %p %p\n", ctx, sv );
//XXX TODO: Handle haptics, etc.
@@ -508,8 +519,19 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c
if( r != sizeof( vive_magic_enable_lighthouse2 ) ) return 5;
}
+ if (sv->udev[USB_DEV_W_WATCHMAN1])
+ {
+ static uint8_t vive_magic_enable_lighthouse[5] = { 0x04 };
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1], 0, vive_magic_enable_lighthouse, sizeof( vive_magic_enable_lighthouse ) );
+ if( r != sizeof( vive_magic_enable_lighthouse ) ) return 5;
+
+ static uint8_t vive_magic_enable_lighthouse2[5] = { 0x07, 0x02 }; //Switch to 0x25 mode (able to get more light updates)
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1], 0, vive_magic_enable_lighthouse2, sizeof( vive_magic_enable_lighthouse2 ) );
+ if( r != sizeof( vive_magic_enable_lighthouse2 ) ) return 5;
+ }
+
#if 0
- for( i = 0; i < 256; i++ )
+ for( int i = 0; i < 256; i++ )
{
static uint8_t vive_controller_haptic_pulse[64] = { 0xff, 0x8f, 0xff, 0, 0, 0, 0, 0, 0, 0 };
r = update_feature_report( sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
@@ -518,6 +540,14 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c
OGUSleep( 1000 );
}
#endif
+
+ if (sv->udev[USB_DEV_TRACKER0])
+ {
+ static uint8_t vive_magic_power_on[64] = { 0x04, 0x78, 0x29, 0x38 };
+ r = update_feature_report( sv->udev[USB_DEV_TRACKER0], 0, vive_magic_power_on, sizeof( vive_magic_power_on ) );
+ if( r != sizeof( vive_magic_power_on ) ) return 5;
+ }
+
SV_INFO( "Powered unit on." );
}
else
@@ -553,7 +583,7 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c
return 0;
}
-void survive_vive_usb_close( struct SurviveViveData * sv )
+void survive_vive_usb_close( SurviveViveData * sv )
{
int i;
#ifdef HIDAPI
@@ -578,18 +608,19 @@ void survive_vive_usb_close( struct SurviveViveData * sv )
#endif
}
-int survive_vive_usb_poll( struct SurviveContext * ctx, void * v )
+int survive_vive_usb_poll( SurviveContext * ctx, void * v )
{
#ifdef HIDAPI
OGUnlockMutex( GlobalRXUSBMutx );
OGUSleep( 100 );
OGUnlockMutex( GlobalRXUSBMutx );
+ return 0;
#else
- struct SurviveViveData * sv = v;
+ SurviveViveData * sv = v;
int r = libusb_handle_events( sv->usbctx );
if( r )
{
- struct SurviveContext * ctx = sv->ctx;
+ SurviveContext * ctx = sv->ctx;
SV_ERROR( "Libusb poll failed." );
}
return r;
@@ -598,9 +629,9 @@ int survive_vive_usb_poll( struct SurviveContext * ctx, void * v )
}
-int survive_get_config( char ** config, struct SurviveViveData * sv, int devno, int iface, int send_extra_magic )
+int survive_get_config( char ** config, SurviveViveData * sv, int devno, int iface, int send_extra_magic )
{
- struct SurviveContext * ctx = sv->ctx;
+ SurviveContext * ctx = sv->ctx;
int ret, count = 0, size = 0;
uint8_t cfgbuff[64];
uint8_t compressed_data[8192];
@@ -643,6 +674,7 @@ int survive_get_config( char ** config, struct SurviveViveData * sv, int devno,
OGUSleep(1000);
}
+ // Send Report 16 to prepare the device for reading config info
memset( cfgbuff, 0, sizeof( cfgbuff ) );
cfgbuff[0] = 0x10;
if( ( ret = hid_get_feature_report_timeout( dev, iface, cfgbuff, sizeof( cfgbuff ) ) ) < 0 )
@@ -652,6 +684,7 @@ int survive_get_config( char ** config, struct SurviveViveData * sv, int devno,
}
+ // Now do a bunch of Report 17 until there are no bytes left
cfgbuff[1] = 0xaa;
cfgbuff[0] = 0x11;
do
@@ -716,7 +749,7 @@ int survive_get_config( char ** config, struct SurviveViveData * sv, int devno,
#define POP2 (*(((uint16_t*)((readdata+=2)-2))))
#define POP4 (*(((uint32_t*)((readdata+=4)-4))))
-static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
+static void handle_watchman( SurviveObject * w, uint8_t * readdata )
{
uint8_t startread[29];
@@ -738,7 +771,7 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
qty-=2;
int propset = 0;
int doimu = 0;
-
+ int i;
if( (type & 0xf0) == 0xf0 )
{
@@ -883,11 +916,12 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
LightcapElement les[10];
int lese = 0; //les's end
+
//Second, go through all LEDs and extract the lightevent from them.
{
uint8_t *marked;
marked = alloca(nrtime);
- memset( marked, 0, sizeof( marked ) );
+ memset( marked, 0, nrtime );
int i, parpl = 0;
timecount--;
int timepl = 0;
@@ -900,8 +934,20 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
led >>= 3;
while( marked[timepl] ) timepl++;
+
+#ifdef DEBUG_WATCHMAN
+ int i;
+ printf( "TP %d TC: %d : ", timepl, timecount );
+ for( i = 0; i < nrtime; i++ )
+ {
+ printf( "%d", marked[i] );
+ }
+ printf( "\n" );
+#endif
+
if( timepl > timecount ) { fault = 3; goto end; } //Ran off max of list.
uint32_t endtime = times[timepl++];
+
int end = timepl + adv;
if( end > timecount ) { fault = 4; goto end; } //end referencing off list
if( marked[end] > 0 ) { fault = 5; goto end; } //Already marked trying to be used.
@@ -945,7 +991,7 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
end:
{
SurviveContext * ctx = w->ctx;
- SV_INFO( "Light decoding fault: %d\n", fault );
+ SV_INFO( "Light decoding fault: %d", fault );
}
}
}
@@ -982,7 +1028,7 @@ void survive_data_cb( SurviveUSBInterface * si )
{
case USB_IF_HMD:
{
- struct SurviveObject * headset = obj;
+ SurviveObject * headset = obj;
readdata+=2;
headset->buttonmask = POP1; //Lens
headset->axis2 = POP2; //Lens Separation
@@ -997,6 +1043,7 @@ void survive_data_cb( SurviveUSBInterface * si )
break;
}
case USB_IF_LIGHTHOUSE:
+ case USB_IF_W_WATCHMAN1:
{
int i;
//printf( "%d -> ", size );
@@ -1056,7 +1103,7 @@ void survive_data_cb( SurviveUSBInterface * si )
// TODO: Looks like this will need to be handle_tracker, since
// it appears the interface is sufficiently different.
// More work needd to reverse engineer it.
- handle_watchman( w, readdata);
+ //handle_wired_watchman( w, readdata, size);
}
else
{
@@ -1078,6 +1125,23 @@ void survive_data_cb( SurviveUSBInterface * si )
}
break;
}
+ case USB_IF_W_WATCHMAN1_LIGHTCAP:
+ {
+ int i=0;
+ for( i = 0; i < 7; i++ )
+ {
+ unsigned short *sensorId = (unsigned short *)readdata;
+ unsigned short *length = (unsigned short *)(&(readdata[2]));
+ unsigned long *time = (unsigned long *)(&(readdata[4]));
+ LightcapElement le;
+ le.sensor_id = POP2;
+ le.length = POP2;
+ le.timestamp = POP4;
+ if( le.sensor_id == 0xff ) break;
+ handle_lightcap( obj, &le );
+ }
+ break;
+ }
}
}
@@ -1246,6 +1310,7 @@ int DriverRegHTCVive( SurviveContext * ctx )
SurviveObject * wm0 = calloc( 1, sizeof( SurviveObject ) );
SurviveObject * wm1 = calloc( 1, sizeof( SurviveObject ) );
SurviveObject * tr0 = calloc( 1, sizeof( SurviveObject ) );
+ SurviveObject * ww0 = calloc( 1, sizeof( SurviveObject ) );
SurviveViveData * sv = calloc( 1, sizeof( SurviveViveData ) );
sv->ctx = ctx;
@@ -1271,9 +1336,12 @@ int DriverRegHTCVive( SurviveContext * ctx )
tr0->ctx = ctx;
memcpy( tr0->codename, "TR0", 4 );
memcpy( tr0->drivername, "HTC", 4 );
+ ww0->ctx = ctx;
+ memcpy( ww0->codename, "WW0", 4 );
+ memcpy( ww0->drivername, "HTC", 4 );
//USB must happen last.
- if( r = survive_usb_init( sv, hmd, wm0, wm1, tr0) )
+ if( r = survive_usb_init( sv, hmd, wm0, wm1, tr0, ww0) )
{
//TODO: Cleanup any libUSB stuff sitting around.
goto fail_gracefully;
@@ -1283,20 +1351,35 @@ int DriverRegHTCVive( SurviveContext * ctx )
if( sv->udev[USB_DEV_HMD] && LoadConfig( sv, hmd, 1, 0, 0 )) { SV_INFO( "HMD config issue." ); }
if( sv->udev[USB_DEV_WATCHMAN1] && LoadConfig( sv, wm0, 2, 0, 1 )) { SV_INFO( "Watchman 0 config issue." ); }
if( sv->udev[USB_DEV_WATCHMAN2] && LoadConfig( sv, wm1, 3, 0, 1 )) { SV_INFO( "Watchman 1 config issue." ); }
- if( sv->udev[USB_DEV_TRACKER0] && LoadConfig( sv, tr0, 4, 0, 1 )) { SV_INFO( "Tracker 0 config issue." ); }
+ if( sv->udev[USB_DEV_TRACKER0] && LoadConfig( sv, tr0, 4, 0, 0 )) { SV_INFO( "Tracker 0 config issue." ); }
+ if( sv->udev[USB_DEV_W_WATCHMAN1] && LoadConfig( sv, ww0, 5, 0, 0 )) { SV_INFO( "Wired Watchman 0 config issue." ); }
hmd->timebase_hz = wm0->timebase_hz = wm1->timebase_hz = 48000000;
+ tr0->timebase_hz = ww0->timebase_hz = hmd->timebase_hz;
+
hmd->pulsedist_max_ticks = wm0->pulsedist_max_ticks = wm1->pulsedist_max_ticks = 500000;
+ tr0->pulsedist_max_ticks = ww0->pulsedist_max_ticks = hmd->pulsedist_max_ticks;
+
hmd->pulselength_min_sync = wm0->pulselength_min_sync = wm1->pulselength_min_sync = 2200;
+ tr0->pulselength_min_sync = ww0->pulselength_min_sync = hmd->pulselength_min_sync;
+
hmd->pulse_in_clear_time = wm0->pulse_in_clear_time = wm1->pulse_in_clear_time = 35000;
+ tr0->pulse_in_clear_time = ww0->pulse_in_clear_time = hmd->pulse_in_clear_time;
+
hmd->pulse_max_for_sweep = wm0->pulse_max_for_sweep = wm1->pulse_max_for_sweep = 1800;
+ tr0->pulse_max_for_sweep = ww0->pulse_max_for_sweep = hmd->pulse_max_for_sweep;
hmd->pulse_synctime_offset = wm0->pulse_synctime_offset = wm1->pulse_synctime_offset = 20000;
+ tr0->pulse_synctime_offset = ww0->pulse_synctime_offset = hmd->pulse_synctime_offset;
+
hmd->pulse_synctime_slack = wm0->pulse_synctime_slack = wm1->pulse_synctime_slack = 5000;
+ tr0->pulse_synctime_slack = ww0->pulse_synctime_slack = hmd->pulse_synctime_slack;
hmd->timecenter_ticks = hmd->timebase_hz / 240;
wm0->timecenter_ticks = wm0->timebase_hz / 240;
wm1->timecenter_ticks = wm1->timebase_hz / 240;
+ tr0->timecenter_ticks = tr0->timebase_hz / 240;
+ ww0->timecenter_ticks = ww0->timebase_hz / 240;
/*
int i;
int locs = hmd->nr_locations;
@@ -1324,6 +1407,7 @@ int DriverRegHTCVive( SurviveContext * ctx )
if( sv->udev[USB_DEV_WATCHMAN1] ) { survive_add_object( ctx, wm0 ); }
if( sv->udev[USB_DEV_WATCHMAN2] ) { survive_add_object( ctx, wm1 ); }
if( sv->udev[USB_DEV_TRACKER0] ) { survive_add_object( ctx, tr0 ); }
+ if( sv->udev[USB_DEV_W_WATCHMAN1] ) { survive_add_object( ctx, ww0 ); }
survive_add_driver( ctx, sv, survive_vive_usb_poll, survive_vive_close, survive_vive_send_magic );
@@ -1333,6 +1417,7 @@ fail_gracefully:
free( wm0 );
free( wm1 );
free( tr0 );
+ free( ww0 );
survive_vive_usb_close( sv );
free( sv );
return -1;