summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2013-03-03 00:56:06 +0000
committerPete Batard <pete@akeo.ie>2013-03-03 00:56:06 +0000
commitbaf714f5e0f22b968cea0e747c23eeced44f602e (patch)
tree13417c4e29fbeec074c62921471e85bbcb720daf
parent0ded9c126e9b48b5ed217e60d392cfb882cbc351 (diff)
downloadlibusb-baf714f5e0f22b968cea0e747c23eeced44f602e.tar.gz
WinCE: Post integration cleanup
* Update copyrights and switch to UTF-8 everywhere * Add SleepEx() to missing.h, and move include to libusbi.h * Remove ifdef for GetSystemTimeAsFileTime()
-rw-r--r--libusb/core.c3
-rw-r--r--libusb/libusbi.h3
-rw-r--r--libusb/os/poll_windows.c15
-rw-r--r--libusb/os/poll_windows.h3
-rw-r--r--libusb/os/threads_windows.c15
-rw-r--r--libusb/os/wince_usb.c6
-rw-r--r--libusb/os/wince_usb.h6
-rw-r--r--libusb/os/windows_common.h1
-rw-r--r--libusb/version_nano.h2
-rw-r--r--msvc/missing.h5
10 files changed, 24 insertions, 35 deletions
diff --git a/libusb/core.c b/libusb/core.c
index 01b8082..b3df73a 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -33,9 +33,6 @@
#endif
#include "libusbi.h"
-#ifdef HAVE_MISSING_H
-#include "missing.h"
-#endif
#if defined(OS_LINUX)
const struct usbi_os_backend * const usbi_backend = &linux_usbfs_backend;
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index e296a2c..eed549e 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -31,6 +31,9 @@
#include <poll.h>
#endif
+#ifdef HAVE_MISSING_H
+#include "missing.h"
+#endif
#include "libusb.h"
#include "version.h"
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c
index 559988a..da97ca9 100644
--- a/libusb/os/poll_windows.c
+++ b/libusb/os/poll_windows.c
@@ -1,6 +1,7 @@
/*
* poll_windows: poll compatibility wrapper for Windows
- * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
+ * Copyright © 2012-2013 RealVNC Ltd.
+ * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
@@ -52,7 +53,7 @@
#else
// MSVC++ < 2005 cannot use a variadic argument and non MSVC
// compilers produce warnings if parenthesis are ommitted.
-#if defined(_MSC_VER) && _MSC_VER < 1400
+#if defined(_MSC_VER) && (_MSC_VER < 1400)
#define poll_dbg
#else
#define poll_dbg(...)
@@ -63,12 +64,6 @@
#pragma warning(disable:28719)
#endif
-#if defined(_WIN32_WCE)
-#define usbi_sleep(ms) Sleep(ms)
-#else
-#define usbi_sleep(ms) SleepEx(ms, TRUE)
-#endif
-
#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
// public fd data
@@ -157,7 +152,7 @@ void init_polling(void)
int i;
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
- usbi_sleep(0);
+ SleepEx(0, TRUE);
}
if (!is_polling_set) {
setup_cancel_io();
@@ -225,7 +220,7 @@ void exit_polling(void)
int i;
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
- usbi_sleep(0);
+ SleepEx(0, TRUE);
}
if (is_polling_set) {
is_polling_set = FALSE;
diff --git a/libusb/os/poll_windows.h b/libusb/os/poll_windows.h
index 32145fd..1e92dda 100644
--- a/libusb/os/poll_windows.h
+++ b/libusb/os/poll_windows.h
@@ -1,6 +1,7 @@
/*
* Windows compat: POSIX compatibility wrapper
- * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
+ * Copyright © 2012-2013 RealVNC Ltd.
+ * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
diff --git a/libusb/os/threads_windows.c b/libusb/os/threads_windows.c
index 9548252..cad27e9 100644
--- a/libusb/os/threads_windows.c
+++ b/libusb/os/threads_windows.c
@@ -25,12 +25,6 @@
#include "libusbi.h"
-#if defined(_WIN32_WCE)
-#define usbi_sleep(ms) Sleep(ms)
-#else
-#define usbi_sleep(ms) SleepEx(ms, TRUE)
-#endif
-
extern const uint64_t epoch_time;
int usbi_mutex_init(usbi_mutex_t *mutex,
@@ -77,7 +71,7 @@ int usbi_mutex_unlock(usbi_mutex_t *mutex) {
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex) {
if(!mutex) return ((errno=EINVAL));
while (InterlockedExchange((LONG *)mutex, 1) == 1) {
- usbi_sleep(0);
+ SleepEx(0, TRUE);
}
return 0;
}
@@ -87,8 +81,6 @@ int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
return 0;
}
-
-
int usbi_cond_init(usbi_cond_t *cond,
const usbi_condattr_t *attr) {
UNUSED(attr);
@@ -190,13 +182,10 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
struct timespec cur_time_ns;
DWORD millis;
-#ifdef _WIN32_WCE
+ // GetSystemTimeAsFileTime() is not available on CE
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &filetime);
-#else
- GetSystemTimeAsFileTime(&filetime);
-#endif
rtime.LowPart = filetime.dwLowDateTime;
rtime.HighPart = filetime.dwHighDateTime;
rtime.QuadPart -= epoch_time;
diff --git a/libusb/os/wince_usb.c b/libusb/os/wince_usb.c
index b90950f..354c0e6 100644
--- a/libusb/os/wince_usb.c
+++ b/libusb/os/wince_usb.c
@@ -1,8 +1,8 @@
/*
- * Windows CE backend for libusb 1.0
- * Copyright (C) 2011-2012 RealVNC Ltd.
+ * Windows CE backend for libusbx 1.0
+ * Copyright © 2011-2013 RealVNC Ltd.
* Large portions taken from Windows backend, which is
- * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
+ * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
* Major code testing contribution by Xiaofan Chen
diff --git a/libusb/os/wince_usb.h b/libusb/os/wince_usb.h
index b125721..3db9693 100644
--- a/libusb/os/wince_usb.h
+++ b/libusb/os/wince_usb.h
@@ -1,8 +1,8 @@
/*
- * Windows CE backend for libusb 1.0
- * Copyright (C) 2011-2012 RealVNC Ltd.
+ * Windows CE backend for libusbx 1.0
+ * Copyright © 2011-2013 RealVNC Ltd.
* Portions taken from Windows backend, which is
- * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
+ * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
* Major code testing contribution by Xiaofan Chen
diff --git a/libusb/os/windows_common.h b/libusb/os/windows_common.h
index c063678..3230b02 100644
--- a/libusb/os/windows_common.h
+++ b/libusb/os/windows_common.h
@@ -3,6 +3,7 @@
*
* This file brings together header code common between
* the desktop Windows and Windows CE backends.
+ * Copyright © 2012-2013 RealVNC Ltd.
* Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index c6654db..5724385 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10621
+#define LIBUSB_NANO 10622
diff --git a/msvc/missing.h b/msvc/missing.h
index 7846976..183b9d3 100644
--- a/msvc/missing.h
+++ b/msvc/missing.h
@@ -1,6 +1,6 @@
/*
* Header file for missing WinCE functionality
- * Copyright © 2012 RealVNC Ltd.
+ * Copyright © 2012-2013 RealVNC Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,9 @@
#ifndef MISSING_H
#define MISSING_H
+/* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
+#define SleepEx(m, a) Sleep(m)
+
/* Windows CE doesn't have any APIs to query environment variables.
*
* This contains a registry based implementation of getenv.