From 257c0d9b563f91d6613a8dd8c6bb4be0a1366036 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 10:14:52 +0100 Subject: Initial import --- test/test.cc | 44 +++++++++++++++++++++++++++ test/test.vcxproj | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 test/test.cc create mode 100644 test/test.vcxproj (limited to 'test') diff --git a/test/test.cc b/test/test.cc new file mode 100644 index 0000000..4a6e3ee --- /dev/null +++ b/test/test.cc @@ -0,0 +1,44 @@ +#include +#include + +#include + +static void attach_fn(struct libusbhp_device_t *device, void *user_data) +{ + printf("attach\n"); + if(device) printf(" (%04x/%04x)\n", device->idVendor, device->idProduct); +} + +static void detach_fn(struct libusbhp_device_t *device, void *user_data) +{ + printf("detach\n"); + if(device) printf(" (%04x/%04x)\n", device->idVendor, device->idProduct); +} + +int main(int args, char* argv[]) +{ + struct libusbhp_t *handle; + + int ret = libusbhp_init(&handle); + if(ret != 0) { + printf("Could not initialise handle.\n"); + return 1; + } + + libusbhp_register_hotplug_listeners(handle, attach_fn, detach_fn, NULL); + + // 100ms timeout + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 100000; + + while(1) { + int ret = libusbhp_handle_events_timeout(handle, &tv); + if(ret) printf("handle_events failed [%d]...\n", ret); + printf("loop\n"); + } + + libusbhp_exit(handle); + + return 0; +} diff --git a/test/test.vcxproj b/test/test.vcxproj new file mode 100644 index 0000000..be61eef --- /dev/null +++ b/test/test.vcxproj @@ -0,0 +1,90 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + {1b43450c-2534-451f-985c-2d0ba0ef5a43} + + + + {285305E3-918A-458B-BD54-F2D09953F2D2} + Win32Proj + test + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\libusbhp;%(AdditionalIncludeDirectories) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + \ No newline at end of file -- cgit v1.2.3