aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--include/libsurvive/survive.h1
-rwxr-xr-xsrc/survive_vive.c69
3 files changed, 20 insertions, 53 deletions
diff --git a/.gitignore b/.gitignore
index ed33e2b..447300f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,6 @@ windows/calinfo/WM1_normals.csv
windows/calinfo/HMD_points.csv
windows/calinfo/WM0_normals.csv
windows/calinfo/2.json.gz
+windows/calinfo - Copy/WM1_points.csv
+windows/udev[USB_DEV_LIGHTHOUSE]
+windows/udev[USB_DEV_LIGHTHOUSE]
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index 132480f..e6bc68d 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -154,7 +154,6 @@ void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb po
typedef struct
{
uint8_t sensor_id;
- uint8_t type; //Mostly unused. Set to 255 to ignore it.
uint16_t length;
uint32_t timestamp;
} __attribute__((packed)) LightcapElement;
diff --git a/src/survive_vive.c b/src/survive_vive.c
index c3967cd..99d69a3 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -480,36 +480,23 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c
if( turnon )
{
- //Magic from vl_magic.h, originally copywritten under LGPL.
- // * Copyright (C) 2013 Fredrik Hultin
- // * Copyright (C) 2013 Jakob Bornecrantz
-#if 0
- static uint8_t vive_magic_power_on[] = {
- 0x04, 0x78, 0x29, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,
- 0xa8, 0x0d, 0x76, 0x00, 0x40, 0xfc, 0x01, 0x05, 0xfa, 0xec, 0xd1, 0x6d, 0x00,
- 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x0d, 0x76, 0x00, 0x68, 0xfc,
- 0x01, 0x05, 0x2c, 0xb0, 0x2e, 0x65, 0x7a, 0x0d, 0x76, 0x00, 0x68, 0x54, 0x72,
- 0x00, 0x18, 0x54, 0x72, 0x00, 0x00, 0x6a, 0x72, 0x00, 0x00, 0x00, 0x00,
- };
-#else
//From actual steam.
- static uint8_t vive_magic_power_on[64] = { 0x04, 0x78, 0x29, 0x38,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-#endif
if (sv->udev[USB_DEV_HMD])
{
+ static uint8_t vive_magic_power_on[64] = { 0x04, 0x78, 0x29, 0x38 };
r = update_feature_report( sv->udev[USB_DEV_HMD], 0, vive_magic_power_on, sizeof( vive_magic_power_on ) );
if( r != sizeof( vive_magic_power_on ) ) return 5;
}
if (sv->udev[USB_DEV_LIGHTHOUSE])
{
- static uint8_t vive_magic_enable_lighthouse[64] = { 0x04 }; //[64] wat? Why did that fix it?
- r = update_feature_report( sv->udev[USB_DEV_LIGHTHOUSE], 0, vive_magic_enable_lighthouse, sizeof( vive_magic_enable_lighthouse ) ); ///XXX TODO: Shouldn't this be LIGHTHOUSEB for hidapi?
+ static uint8_t vive_magic_enable_lighthouse[5] = { 0x04 };
+ r = update_feature_report( sv->udev[USB_DEV_LIGHTHOUSE], 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_LIGHTHOUSE], 0, vive_magic_enable_lighthouse2, sizeof( vive_magic_enable_lighthouse2 ) );
+ if( r != sizeof( vive_magic_enable_lighthouse2 ) ) return 5;
}
#if 0
@@ -621,16 +608,7 @@ int survive_get_config( char ** config, struct SurviveViveData * sv, int devno,
int k;
- uint8_t cfgbuff_send[64] = {
- 0xff, 0x83, 0x00, 0xb6, 0x5b, 0xb0, 0x78, 0x69,
- 0x0f, 0xf8, 0x78, 0x69, 0x0f, 0xa0, 0xf3, 0x18,
- 0x00, 0xe8, 0xf2, 0x18, 0x00, 0x27, 0x44, 0x5a,
- 0x0f, 0xf8, 0x78, 0x69, 0x0f, 0xf0, 0x77, 0x69,
- 0x0f, 0xf0, 0x77, 0x69, 0x0f, 0x50, 0xca, 0x45,
- 0x77, 0xa0, 0xf3, 0x18, 0x00, 0xf8, 0x78, 0x69,
- 0x0f, 0x00, 0x00, 0xa0, 0x0f, 0xa0, 0x9b, 0x0a,
- 0x01, 0x00, 0x00, 0x35, 0x00, 0x34, 0x02, 0x00
- };
+ uint8_t cfgbuff_send[64] = { 0xff, 0x83 };
#ifdef HIDAPI
//XXX TODO WRITEME
@@ -928,7 +906,6 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
//Use insertion sort, since we should most of the time, be in order.
LightcapElement * le = &les[lese++];
le->sensor_id = led;
- le->type = 0xfe;
if( (uint32_t)(endtime - starttime) > 65535 ) { fault = 6; goto end; } //Length of pulse dumb.
le->length = endtime - starttime;
@@ -1082,28 +1059,16 @@ void survive_data_cb( SurviveUSBInterface * si )
case USB_IF_LIGHTCAP:
{
int i;
-
- if( si->buffer[0] == 0x25 ) //Once the valve drivers run, they somehow put the HMD into 7-byte-width messages.
+ for( i = 0; i < 9; i++ )
{
- for( i = 0; i < 9; i++ )
- {
- LightcapElement le;
- le.sensor_id = POP1;
- le.type = 0xfe;
- le.length = POP2;
- le.timestamp = POP4;
- if( le.sensor_id == 0xff ) break;
- handle_lightcap( obj, &le );
- }
- }
- else //Otherwise, we're in the old mode.
- {
- for( i = 0; i < 7; i++ )
- {
- handle_lightcap( obj, (LightcapElement*)&readdata[i*8] );
- }
- break;
- }
+ LightcapElement le;
+ le.sensor_id = POP1;
+ le.length = POP2;
+ le.timestamp = POP4;
+ if( le.sensor_id == 0xff ) break;
+ handle_lightcap( obj, &le );
+ }
+ break;
}
}
}