From 6daf2506fcfbfcd26d63a8bddba319d67ecc33e5 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Thu, 16 Mar 2017 00:47:54 -0400 Subject: Fix crashes in Linux without hidapi, and fix buffer overflow bug. --- src/survive_cal.c | 2 +- src/survive_vive.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/survive_cal.c b/src/survive_cal.c index 0ea9337..985ab24 100755 --- a/src/survive_cal.c +++ b/src/survive_cal.c @@ -267,7 +267,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 ); + //printf( "Dev %d, LH %d not enough visible points found.\n", i, j ); cd->found_common = 0; return; } diff --git a/src/survive_vive.c b/src/survive_vive.c index 3930a2c..18b2742 100755 --- a/src/survive_vive.c +++ b/src/survive_vive.c @@ -59,9 +59,13 @@ const char * devnames[] = { #define USB_DEV_WATCHMAN1 2 #define USB_DEV_WATCHMAN2 3 #define USB_DEV_TRACKER0 4 + +#ifdef HIDAPI #define USB_DEV_LIGHTHOUSEB 5 #define MAX_USB_DEVS 6 - +#else +#define MAX_USB_DEVS 5 +#endif #define USB_IF_HMD 0 #define USB_IF_LIGHTHOUSE 1 @@ -402,6 +406,7 @@ int survive_usb_init( struct SurviveViveData * sv, struct SurviveObject * hmd, s if( d == 0 ) { + printf( "!!%p %d %04x %04x %d\n", devnames[i], i, vid, pid, which ); SV_INFO( "Did not find device %s (%04x:%04x.%d)", devnames[i], vid, pid, which ); sv->udev[i] = 0; continue; @@ -1199,7 +1204,7 @@ printf( "Loading config: %d\n", len ); return 1; } - char fname[20]; + char fname[64]; sprintf( fname, "calinfo/%s_points.csv", so->codename ); FILE * f = fopen( fname, "w" ); -- cgit v1.2.3