aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormwturvey <michael.w.turvey@intel.com>2017-03-23 16:26:27 -0700
committermwturvey <michael.w.turvey@intel.com>2017-03-23 16:26:27 -0700
commit3d86dda66d50d1e1955d4e0cd5f374e0aed1789f (patch)
tree42ca25361a394a1213b2808c0607858055555d9d
parentf33018188bf5bdf6f6b8af0d646e3f8c519d9d71 (diff)
downloadlibsurvive-3d86dda66d50d1e1955d4e0cd5f374e0aed1789f.tar.gz
libsurvive-3d86dda66d50d1e1955d4e0cd5f374e0aed1789f.tar.bz2
Fixed Windows USB Interface Enumeration
-rwxr-xr-xsrc/survive_cal.c4
-rw-r--r--src/survive_data.c21
-rwxr-xr-xsrc/survive_vive.c18
3 files changed, 27 insertions, 16 deletions
diff --git a/src/survive_cal.c b/src/survive_cal.c
index f9ec595..81889ca 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -155,7 +155,7 @@ void survive_cal_install( struct SurviveContext * ctx )
{
if (requiredTrackersFound != ((strlen(RequiredTrackersForCal) + 1) / 4))
{
- SV_ERROR( "Error: cannot find all devices needed for calibration." );
+ SV_ERROR( "Error: Did not find all devices required for calibration." );
free( cd );
return;
}
@@ -201,7 +201,7 @@ void survive_cal_light( struct SurviveObject * so, int sensor_id, int acode, int
if( sensor_id < 0 )
{
int lhid = -sensor_id-1;
- // Take the OOTX data from the first device.
+ // Take the OOTX data from the first device. (if using HMD, WM0, WM1 only, this will be HMD)
if( lhid < NUM_LIGHTHOUSES && so == cd->poseobjects[0] )
{
uint8_t dbit = (acode & 2)>>1;
diff --git a/src/survive_data.c b/src/survive_data.c
index da4e0a2..ce263ed 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -208,13 +208,14 @@ void handle_lightcap2_sweep(SurviveObject * so, LightcapElement * le )
// assume that the longest (i.e. strongest signal) is most likely
// the non-reflected signal.
- if (le->length < 80)
- {
- // this is a low-quality read. Better to throw it out than to use it.
- //fprintf(stderr, "%2d %d\n", le->sensor_id, le->length);
- return;
- }
- fprintf(stderr, "%2d %d\n", le->sensor_id, le->length);
+ //if (le->length < 80)
+ //{
+ // // this is a low-quality read. Better to throw it out than to use it.
+ // //fprintf(stderr, "%2d %d\n", le->sensor_id, le->length);
+ // return;
+ //}
+ //fprintf(stderr, "%2d %d\n", le->sensor_id, le->length);
+ //fprintf(stderr, ".");
if (lcd->sweep.sweep_len[le->sensor_id] < le->length)
{
@@ -269,8 +270,8 @@ int32_t decode_acode(uint32_t length, int32_t main_divisor) {
void handle_lightcap( SurviveObject * so, LightcapElement * le )
{
SurviveContext * ctx = so->ctx;
-// handle_lightcap2(so,le);
-// return;
+ handle_lightcap2(so,le);
+ return;
//int32_t deltat = (uint32_t)le->timestamp - (uint32_t)so->last_master_time;
@@ -373,7 +374,7 @@ void handle_lightcap( SurviveObject * so, LightcapElement * le )
int base_station = is_new_pulse;
//printf( "%s %d %d %d\n", so->codename, le->sensor_id, so->sync_set_number, le->length );
ctx->lightproc( so, le->sensor_id, -3 - so->sync_set_number, 0, le->timestamp, le->length, base_station);
- }
+ }
}
diff --git a/src/survive_vive.c b/src/survive_vive.c
index f6465b2..bfe4926 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -340,7 +340,7 @@ int survive_usb_init( SurviveViveData * sv, SurviveObject * hmd, SurviveObject *
if (cur_dev->vendor_id == vendor_id &&
cur_dev->product_id == product_id)
{
- if( menum == enumid )
+ if( cur_dev->interface_number == enumid )
{
path_to_open = cur_dev->path;
break;
@@ -521,12 +521,21 @@ int survive_vive_send_magic(SurviveContext * ctx, void * drv, int magic_code, vo
if (sv->udev[USB_DEV_W_WATCHMAN1])
{
+ //static uint8_t vive_magic_power_on[64] = { 0x04, 0x78, 0x29, 0x38 };
+ static uint8_t vive_magic_power_on[5] = { 0x04 };
+ //static uint8_t vive_magic_power_on[5] = { 0x04, 0x00, 0xc3, 0xe2, 0x04 };
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1], 0, vive_magic_power_on, sizeof( vive_magic_power_on ) );
+ if( r != sizeof( vive_magic_power_on ) ) return 5;
+ }
+ if (sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP])
+ {
+ //static uint8_t vive_magic_enable_lighthouse[64] = { 0x04, 0x78, 0x29, 0x38 };
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 ) );
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP], 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 ) );
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP], 0, vive_magic_enable_lighthouse2, sizeof( vive_magic_enable_lighthouse2 ) );
if( r != sizeof( vive_magic_enable_lighthouse2 ) ) return 5;
}
@@ -534,7 +543,8 @@ int survive_vive_send_magic(SurviveContext * ctx, void * drv, int magic_code, vo
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 ) );
+ //r = update_feature_report( sv->udev[USB_DEV_WATCHMAN1], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
+ r = update_feature_report( sv->udev[USB_DEV_W_WATCHMAN1_LIGHTCAP], 0, vive_controller_haptic_pulse, sizeof( vive_controller_haptic_pulse ) );
SV_INFO( "UCR: %d", r );
if( r != sizeof( vive_controller_haptic_pulse ) ) return 5;
OGUSleep( 1000 );