Skip to content

Commit

Permalink
port to libusb-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalten committed Jun 28, 2017
1 parent a17a7ae commit 27a2baa
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 147 deletions.
3 changes: 2 additions & 1 deletion tuio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INCLUDES = -I./TUIO -I./oscpack -I../userspace
#CFLAGS = -g -Wall
CFLAGS = -w -O3
CXXFLAGS = $(CFLAGS) $(INCLUDES) -D$(ENDIANESS)
LD_FLAGS = -lpthread -lusb-1.0

SUR40_SOURCES = Sur40_TUIO.cpp ../userspace/surface.cpp
COMMON_TUIO_SOURCES = ./TUIO/TuioTime.cpp ./TUIO/TuioPoint.cpp ./TUIO/TuioContainer.cpp ./TUIO/TuioObject.cpp ./TUIO/TuioCursor.cpp ./TUIO/TuioBlob.cpp ./TUIO/TuioDispatcher.cpp ./TUIO/TuioManager.cpp ./TUIO/OneEuroFilter.cpp
Expand All @@ -30,7 +31,7 @@ all: $(SUR40_TUIO)

$(SUR40_TUIO): $(COMMON_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) $(SUR40_OBJECTS) $(COBJECTS)
@echo [LD] $(SUR40_TUIO)
@ $(CXX) -o $@ $+ -lpthread -lusb $(LD_FLAGS)
@ $(CXX) -o $@ $+ $(LD_FLAGS)

clean:
@echo [CLEAN] $(SUR40_TUIO)
Expand Down
6 changes: 3 additions & 3 deletions tuio/Sur40_TUIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "Sur40_TUIO.h"

Sur40_TUIO *sur40_tuio = NULL;
usb_dev_handle* sur40 = NULL;
libusb_device_handle* sur40 = NULL;
bool verbose = false;

static void terminate (int param)
Expand Down Expand Up @@ -126,7 +126,7 @@ int main(int argc, char* argv[])
signal(SIGTERM,terminate);
#endif

sur40 = usb_get_device_handle( ID_MICROSOFT, ID_SURFACE );
sur40 = sur40_get_device_handle();
if (sur40 == NULL) {
std::cout << "no SUR40 found" << std::endl;
return 0;
Expand Down Expand Up @@ -164,6 +164,6 @@ int main(int argc, char* argv[])

delete sur40_tuio;
delete server;
usb_close(sur40);
sur40_close_device(sur40);
return 0;
}
8 changes: 4 additions & 4 deletions userspace/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#CFLAGS=-ggdb -Wall
#CFLAGS=-g -Wall
CFLAGS=-O3 -w

%.o: %.cpp surface.h
Expand All @@ -12,13 +12,13 @@ clean:

test: test.o surface.o
@echo [LD] $@
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb-1.0

view: view.o surface.o
@echo [LD] $@
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb -lGL -lGLU -lglut
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb-1.0 -lGL -lGLU -lglut

calib: calib.o surface.o
@echo [LD] $@
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb -lGL -lGLU -lglut
@ $(CXX) $(CFLAGS) -o $@ $^ -lusb-1.0 -lGL -lGLU -lglut

8 changes: 4 additions & 4 deletions userspace/calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void deinterlace( uint8_t* input, uint8_t* output ) {
}


usb_dev_handle* s40;
libusb_device_handle* s40;
GLuint texture;
int mode = 1;

Expand Down Expand Up @@ -228,8 +228,8 @@ void keyboard(unsigned char key, int x, int y) {
switch (key) {
case 'q':
//usb_reset( s40 ); sleep(1);
usb_close( s40 );
exit(0);
sur40_close_device( s40 );
exit(0);
break;
case 'c':
surface_calib_start( s40 );
Expand Down Expand Up @@ -304,7 +304,7 @@ void initGL() {

int main(int argc, char* argv[]) {

s40 = usb_get_device_handle( ID_MICROSOFT, ID_SURFACE );
s40 = sur40_get_device_handle();
surface_init( s40 );

glutInitWindowSize(VIDEO_RES_X,VIDEO_RES_Y*2);
Expand Down
Loading

0 comments on commit 27a2baa

Please sign in to comment.