aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-03-16 00:47:54 -0400
committercnlohr <lohr85@gmail.com>2017-03-16 00:47:54 -0400
commit6daf2506fcfbfcd26d63a8bddba319d67ecc33e5 (patch)
treef0743f70c4cbf877d3bdbcefdeb675505bb4ba72
parent7dc4d180e0ce95ad6e9eeb2606a4516b93e872f5 (diff)
downloadlibsurvive-6daf2506fcfbfcd26d63a8bddba319d67ecc33e5.tar.gz
libsurvive-6daf2506fcfbfcd26d63a8bddba319d67ecc33e5.tar.bz2
Fix crashes in Linux without hidapi, and fix buffer overflow bug.
-rw-r--r--Makefile2
-rwxr-xr-xsrc/survive_cal.c2
-rwxr-xr-xsrc/survive_vive.c9
3 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index c600573..525f7c5 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ all : lib data_recorder test calibrate calibrate_client
CC:=gcc
-CFLAGS:=-Iinclude/libsurvive -I. -fPIC -g -O0 -Iredist -flto -DUSE_DOUBLE -std=gnu99 -rdynamic
+CFLAGS:=-Iinclude/libsurvive -I. -fPIC -g -O3 -Iredist -flto -DUSE_DOUBLE -std=gnu99 -rdynamic
LDFLAGS:=-lpthread -lusb-1.0 -lz -lX11 -lm -flto -g
POSERS:=src/poser_dummy.o src/poser_daveortho.o src/poser_charlesslow.o
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" );