diff --git a/libusbdll/.cdtproject b/libusbdll/.cdtproject index 5824d61..d2a6332 100644 --- a/libusbdll/.cdtproject +++ b/libusbdll/.cdtproject @@ -59,11 +59,25 @@ make - + dll false true + +make + +clean +false +true + + +make + +testExe +false +true + diff --git a/libusbdll/LibusbTest.exe b/libusbdll/LibusbTest.exe index 557c412..e2207d6 100644 Binary files a/libusbdll/LibusbTest.exe and b/libusbdll/LibusbTest.exe differ diff --git a/libusbdll/LibusbWin.dll b/libusbdll/LibusbWin.dll index bff7e5f..b0aef56 100644 Binary files a/libusbdll/LibusbWin.dll and b/libusbdll/LibusbWin.dll differ diff --git a/libusbdll/common.rc b/libusbdll/common.rc new file mode 100644 index 0000000..a463173 --- /dev/null +++ b/libusbdll/common.rc @@ -0,0 +1,35 @@ +#include + +#define RT_MANIFEST 24 +#define ID_MANIFEST 1 + +VS_VERSION_INFO VERSIONINFO +FILEVERSION RC_VERSION +PRODUCTVERSION RC_VERSION +FILEFLAGSMASK 0x3FL +FILEFLAGS 0x0L +FILEOS VOS_NT_WINDOWS32 +FILETYPE RC_FILE_TYPE +FILESUBTYPE RC_FILE_SUB_TYPE +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "http://inf.ntb.ch" + VALUE "FileDescription", RC_PRODUCT_STR + VALUE "FileVersion", RC_VERSION_STR + VALUE "InternalName", RC_FILE_NAME_STR + VALUE "LegalCopyright", "@ 2006 Andreas Schläpfer" + VALUE "OriginalFilename",RC_FILE_NAME_STR + VALUE "ProductName", RC_PRODUCT_STR + VALUE "ProductVersion", RC_VERSION_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + diff --git a/libusbdll/libusb.a b/libusbdll/libusb.a new file mode 100644 index 0000000..42f1d28 Binary files /dev/null and b/libusbdll/libusb.a differ diff --git a/libusbdll/libusb.lib b/libusbdll/libusb.lib deleted file mode 100644 index b5467c0..0000000 Binary files a/libusbdll/libusb.lib and /dev/null differ diff --git a/libusbdll/makefile b/libusbdll/makefile index 2eddc1b..3c3d7f2 100644 --- a/libusbdll/makefile +++ b/libusbdll/makefile @@ -1,20 +1,34 @@ CC = gcc +RM=rm -f +WINDRES = windres SOURCENAME = LibusbWin DDLNAME = LibusbWin EXENAME = LibusbTest JAVAPATH = "C:/Program Files/Java/jdk1.5.0_04" -TARGETDIR = D:/work/USB/libusb/libusbdllMinGW ## -IDLOUT:$(DDLNAME) -MIDL:$(DDLNAME) -TLBOUT:$(DDLNAME) ## $(CC) -LD $(SOURCENAME).c -Fe$(DDLNAME).dll -link libusb.lib +VERSION_MAJOR = 0 +VERSION_MINOR = 0 +VERSION_MICRO = 2 +VERSION_NANO = 0 + +VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).$(VERSION_NANO) +RC_VERSION = $(VERSION_MAJOR),$(VERSION_MINOR),$(VERSION_MICRO),$(VERSION_NANO) +RC_VERSION_STR = '\"$(VERSION)\"' + dll: $(DDLNAME).dll $(DDLNAME).dll: $(SOURCENAME).cpp - $(CC) -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -I$(JAVAPATH)/include -I$(JAVAPATH)/include/win32 -shared $(SOURCENAME).cpp -o $(DDLNAME).dll libusb.lib + $(WINDRES) -o resource.o resource.rc -DRC_VERSION='$(RC_VERSION)' \ + -DRC_VERSION_STR=$(RC_VERSION_STR) + $(CC) -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -mwindows \ + -I$(JAVAPATH)/include -I$(JAVAPATH)/include/win32 -shared \ + $(SOURCENAME).cpp -o $(DDLNAME).dll resource.o libusb.a -cleanDll: - rm $(DDLNAME).dll +clean: + $(RM) $(DDLNAME).dll + $(RM) *.o testExe: $(EXENAME).exe $(EXENAME).exe: $(EXENAME).cpp - $(CC) $(EXENAME).cpp -o $(EXENAME).exe $(TARGETDIR)/libusb.a - + $(CC) $(EXENAME).cpp -o $(EXENAME).exe libusb.a diff --git a/libusbdll/resource.rc b/libusbdll/resource.rc new file mode 100644 index 0000000..fc09671 --- /dev/null +++ b/libusbdll/resource.rc @@ -0,0 +1,8 @@ +#define RC_FILE_TYPE VFT_DLL +#define RC_FILE_SUB_TYPE VFT2_UNKNOWN +#define RC_PRODUCT_STR "Java LibUsb-Win32 wrapper - DLL" +#define RC_FILE_NAME_STR "LibusbWin.dll" + +#include "common.rc" + + diff --git a/libusbdll/usb.h b/libusbdll/usb.h index 04f5afa..4f814df 100644 --- a/libusbdll/usb.h +++ b/libusbdll/usb.h @@ -2,6 +2,7 @@ #define __USB_H__ #include +#include /* * 'interface' is defined somewhere in the Windows header files. This macro @@ -284,7 +285,10 @@ struct usb_dev_handle; typedef struct usb_dev_handle usb_dev_handle; /* Variables */ -extern struct usb_bus *usb_busses; +#ifndef __USB_C__ +#define usb_busses usb_get_busses() +#endif + #include @@ -345,13 +349,27 @@ extern "C" { #define LIBUSB_HAS_INSTALL_SERVICE_NP 1 int usb_install_service_np(void); - + void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + #define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1 int usb_uninstall_service_np(void); + void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); #define LIBUSB_HAS_INSTALL_DRIVER_NP 1 int usb_install_driver_np(const char *inf_file); - + void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + + #define LIBUSB_HAS_TOUCH_INF_FILE_NP 1 + int usb_touch_inf_file_np(const char *inf_file); + void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + + #define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1 + int usb_install_needs_restart_np(void); + const struct usb_version *usb_get_version(void); int usb_isochronous_setup_async(usb_dev_handle *dev, void **context, @@ -363,6 +381,8 @@ extern "C" { int usb_submit_async(void *context, char *bytes, int size); int usb_reap_async(void *context, int timeout); + int usb_reap_async_nocancel(void *context, int timeout); + int usb_cancel_async(void *context); int usb_free_async(void **context);