From b55240eb43a92c552003b8b324a385e041f84f12 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 Dec 2015 02:10:53 +0000 Subject: fish --- host/Makefile | 21 ++++++++++++++------- host/main.c | 17 ++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) (limited to 'host') diff --git a/host/Makefile b/host/Makefile index 667d094..317bc59 100644 --- a/host/Makefile +++ b/host/Makefile @@ -1,17 +1,24 @@ INCLUDES=$(shell pkg-config --cflags libusb-1.0) -LIBS=$(shell pkg-config --libs libusb-1.0) +LIBS=-Bstatic $(shell pkg-config --libs libusb-1.0) -lpthread -Bdynamic -ludev -PROG=cryptopad -CSRCS=main.c hexdump.c +LDFLAGS=-s +PROGS=main set get +LIBSRCS=hexdump.c -OBJS=${CSRCS:%.c=%.o} +LIBOBJS=${LIBSRCS:%.c=%.o} CFLAGS=${OPT} CPPFLAGS=${INCLUDES} ${DEFINES} -${PROG}:${OBJS} - ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} +default:${PROGS} + + +${PROGS}: %:%.o ${LIBOBJS} + ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $@.o ${OBJS} ${LIBS} + +#${PROG}:${OBJS} +# ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} clean: - /bin/rm -f *~ *.d ${PROG} ${OBJS} + /bin/rm -f *~ *.d ${PROGS} ${OBJS} diff --git a/host/main.c b/host/main.c index a779cc1..5a61963 100644 --- a/host/main.c +++ b/host/main.c @@ -1,4 +1,5 @@ #include "project.h" +#include "../common/vendor_req.h" @@ -8,19 +9,21 @@ uint32_t timeout=4000; char buf[128]; int len; + + len= libusb_control_transfer( devh, - /* bmRequestType */ LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_INTERFACE, - /* bRequest */ 0x34, - /* wValue */ 0x1234, - /* wIndex */ 0x5678, + /* bmRequestType */ LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, + /* bRequest */ VENDOR_REQ_KEYPRESS, + /* wValue */ 0x23, + /* wIndex */ 0, /* Data */ buf, /* wLength */ sizeof(buf), timeout ); -if (len>=0) -hexdump(">",buf,len); +//if (len>=0) +//hexdump(">",buf,len); } @@ -87,7 +90,7 @@ int main(int argc,char *argv) errx(EX_IOERR, "unable to initialize libusb: %i", ret); - libusb_set_debug(ctx, 255); + //libusb_set_debug(ctx, 255); probe_devices(ctx); -- cgit v1.2.3