diff --git a/Makefile b/Makefile index 501f1d2..66cadb6 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,15 @@ OBJS = $(SOURCE_FULL:.cpp=.o) PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o) DEFINES += _LINUX_ -DEFINES += _LIBUSB_ +#DEFINES += _LIBUSB_ COMPILE_FLAGS += $(addprefix -D, $(DEFINES)) CUR_PATH = $(shell echo $(PWD)) -INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb ) +INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb ) -I/opt/homebrew/include LOADPATHS = -LIBS = -lusb-1.0 +#LIBS = -lusb-1.0 +LIBS = -lhidapi CPP = g++ diff --git a/src/usbhid/usbhid.cpp b/src/usbhid/usbhid.cpp index ef5fc0a..4e029fc 100644 --- a/src/usbhid/usbhid.cpp +++ b/src/usbhid/usbhid.cpp @@ -21,6 +21,7 @@ limitations under the License. #include +#if 0 UsbHid::UsbHid() { usb_context = NULL; @@ -405,3 +406,4 @@ int UsbHid::read(unsigned char *data, int length) return actual_length; } +#endif \ No newline at end of file diff --git a/src/yk_usb_device.cpp b/src/yk_usb_device.cpp index ef24347..4edbd84 100644 --- a/src/yk_usb_device.cpp +++ b/src/yk_usb_device.cpp @@ -19,13 +19,15 @@ limitations under the License. #ifdef _LIBUSB_ #include #else -#include +//#include #include #endif #include #include #include +#include +#include #ifdef _LIBUSB_ // Uses libusb directly @@ -153,13 +155,9 @@ int UsbDevice::sendHidReport(char *serial, unsigned char *msg, unsigned char *re if (serial) { // Convert to a wchar_t* - size_t origsize = strlen(serial) + 1; - size_t convertedChars = 0; - - mbstowcs_s(&convertedChars, cserial, origsize, serial, _TRUNCATE); - + swprintf(cserial, newsize, L"%s", serial); } - + // Open the USB device handle = hid_open(vid, pid, serial ? cserial : NULL); diff --git a/src/yk_usb_device.h b/src/yk_usb_device.h index 4dc7440..3b240d8 100644 --- a/src/yk_usb_device.h +++ b/src/yk_usb_device.h @@ -19,7 +19,7 @@ limitations under the License. #ifdef _LIBUSB_ #include #else -#include +#include #endif #include