build: Fix Android and Xcode compilation errors/warnings

Commit f69548c3b3 ("examples: Enable all examples to build on all
platforms") modified dpfp and sam3u_benchmark to be buildable on any
platform, however there were some oversights and regressions introduced
for Android and Xcode.

Update the Android and Xcode build files to account for the removal of
dpfp_threaded.c as well as the inclusion of config.h from examples
and/or tests source.

Additionally switch the threaded version of dpfp to use sem_open()
instead of sem_init() as the latter is in fact deprecated on MacOS.

Closes #808

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/.gitignore b/.gitignore
index 1dc2e35..343a446 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,8 @@
 examples/sam3u_benchmark
 examples/testlibusb
 tests/stress
+android/libs
+android/obj
 *.exe
 *.pc
 doc/api-1.0
diff --git a/Xcode/libusb.xcodeproj/project.pbxproj b/Xcode/libusb.xcodeproj/project.pbxproj
index dd33f35..fcda7e2 100644
--- a/Xcode/libusb.xcodeproj/project.pbxproj
+++ b/Xcode/libusb.xcodeproj/project.pbxproj
@@ -34,11 +34,10 @@
 		006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		008A23DA236C85AF004854AA /* stress.c in Sources */ = {isa = PBXBuildFile; fileRef = 008A23C6236C8445004854AA /* stress.c */; };
 		008A23DB236C85AF004854AA /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 008A23CB236C849A004854AA /* testlib.c */; };
-		008A23DC236C85BD004854AA /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		008FBF861628B7E800BC5BE2 /* core.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBF541628B7E800BC5BE2 /* core.c */; };
 		008FBF871628B7E800BC5BE2 /* descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBF551628B7E800BC5BE2 /* descriptor.c */; };
 		008FBF881628B7E800BC5BE2 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBF561628B7E800BC5BE2 /* io.c */; };
-		008FBF891628B7E800BC5BE2 /* libusb.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBF5A1628B7E800BC5BE2 /* libusb.h */; };
+		008FBF891628B7E800BC5BE2 /* libusb.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBF5A1628B7E800BC5BE2 /* libusb.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		008FBF901628B7E800BC5BE2 /* libusbi.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBF671628B7E800BC5BE2 /* libusbi.h */; };
 		008FBF921628B7E800BC5BE2 /* darwin_usb.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBF6C1628B7E800BC5BE2 /* darwin_usb.c */; };
 		008FBF931628B7E800BC5BE2 /* darwin_usb.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBF6D1628B7E800BC5BE2 /* darwin_usb.h */; };
@@ -52,16 +51,10 @@
 		008FBFA91628B88000BC5BE2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBFA81628B88000BC5BE2 /* IOKit.framework */; };
 		008FBFAB1628B8CB00BC5BE2 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBFAA1628B8CB00BC5BE2 /* libobjc.dylib */; };
 		008FBFEF1628BA3500BC5BE2 /* xusb.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFED1628BA0E00BC5BE2 /* xusb.c */; };
-		008FBFF01628BA3A00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		008FBFFF1628BB9600BC5BE2 /* dpfp.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFD71628BA0E00BC5BE2 /* dpfp.c */; };
-		008FC0001628BBCD00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
-		008FC00F1628BBE400BC5BE2 /* dpfp_threaded.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFDB1628BA0E00BC5BE2 /* dpfp_threaded.c */; };
-		008FC0101628BBE900BC5BE2 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		008FC01F1628BC1500BC5BE2 /* fxload.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFE11628BA0E00BC5BE2 /* fxload.c */; };
-		008FC0201628BC1B00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		008FC0211628BC5200BC5BE2 /* ezusb.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFDC1628BA0E00BC5BE2 /* ezusb.c */; };
 		008FC0301628BC7400BC5BE2 /* listdevs.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFE71628BA0E00BC5BE2 /* listdevs.c */; };
-		008FC0311628BC7800BC5BE2 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
 		1438D77A17A2ED9F00166101 /* hotplug.c in Sources */ = {isa = PBXBuildFile; fileRef = 1438D77817A2ED9F00166101 /* hotplug.c */; };
 		1438D77B17A2ED9F00166101 /* hotplug.h in Headers */ = {isa = PBXBuildFile; fileRef = 1438D77917A2ED9F00166101 /* hotplug.h */; };
 		1438D77F17A2F0EA00166101 /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 1438D77E17A2F0EA00166101 /* strerror.c */; };
@@ -69,8 +62,10 @@
 		2018D96124E453D0001589B2 /* events_posix.h in Headers */ = {isa = PBXBuildFile; fileRef = 2018D96024E453D0001589B2 /* events_posix.h */; };
 		20468D70243298C100650534 /* sam3u_benchmark.c in Sources */ = {isa = PBXBuildFile; fileRef = 20468D6E243298C100650534 /* sam3u_benchmark.c */; };
 		20468D7E2432990100650534 /* testlibusb.c in Sources */ = {isa = PBXBuildFile; fileRef = 20468D7C2432990000650534 /* testlibusb.c */; };
-		20468D7F2432993300650534 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
-		20468D802432993C00650534 /* libusb-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 008FBF311628B79300BC5BE2 /* libusb-1.0.0.dylib */; };
+		20951C0325630F5F00ED6351 /* dpfp.c in Sources */ = {isa = PBXBuildFile; fileRef = 008FBFD71628BA0E00BC5BE2 /* dpfp.c */; settings = {COMPILER_FLAGS = "-DDPFP_THREADED"; }; };
+		20951C0625630F8F00ED6351 /* ezusb.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBFDD1628BA0E00BC5BE2 /* ezusb.h */; };
+		20951C0F25630FD300ED6351 /* libusb_testlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 008A23CA236C849A004854AA /* libusb_testlib.h */; };
+		20951C152563125200ED6351 /* libusb.h in Headers */ = {isa = PBXBuildFile; fileRef = 008FBF5A1628B7E800BC5BE2 /* libusb.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -209,90 +204,6 @@
 		};
 /* End PBXContainerItemProxy section */
 
-/* Begin PBXCopyFilesBuildPhase section */
-		006AD41A1C8C5A90007F8C6A /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008A23D1236C8594004854AA /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008FBFBB1628B9FE00BC5BE2 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008FBFF31628BB8B00BC5BE2 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008FC0031628BBDB00BC5BE2 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008FC0131628BC0300BC5BE2 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		008FC0241628BC6B00BC5BE2 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		20468D65243298AE00650534 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-		20468D73243298D300650534 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
-		};
-/* End PBXCopyFilesBuildPhase section */
-
 /* Begin PBXFileReference section */
 		006AD41C1C8C5A90007F8C6A /* hotplugtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = hotplugtest; sourceTree = BUILT_PRODUCTS_DIR; };
 		006AD4231C8C5AAE007F8C6A /* hotplugtest.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = hotplugtest.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
@@ -319,7 +230,6 @@
 		008FBFAA1628B8CB00BC5BE2 /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = usr/lib/libobjc.dylib; sourceTree = SDKROOT; };
 		008FBFBD1628B9FE00BC5BE2 /* xusb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = xusb; sourceTree = BUILT_PRODUCTS_DIR; };
 		008FBFD71628BA0E00BC5BE2 /* dpfp.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = dpfp.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
-		008FBFDB1628BA0E00BC5BE2 /* dpfp_threaded.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = dpfp_threaded.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
 		008FBFDC1628BA0E00BC5BE2 /* ezusb.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ezusb.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
 		008FBFDD1628BA0E00BC5BE2 /* ezusb.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ezusb.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
 		008FBFE11628BA0E00BC5BE2 /* fxload.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = fxload.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
@@ -359,7 +269,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008A23DC236C85BD004854AA /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -377,7 +287,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FBFF01628BA3A00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -385,7 +295,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FC0001628BBCD00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -393,7 +303,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FC0101628BBE900BC5BE2 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -401,7 +311,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FC0201628BC1B00BC5BE2 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -409,7 +319,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FC0311628BC7800BC5BE2 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -417,7 +327,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				20468D7F2432993300650534 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -425,7 +335,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				20468D802432993C00650534 /* libusb-1.0.0.dylib in Frameworks */,
+				006AD4261C8C5AD9007F8C6A /* libusb-1.0.0.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -510,7 +420,6 @@
 			isa = PBXGroup;
 			children = (
 				008FBFD71628BA0E00BC5BE2 /* dpfp.c */,
-				008FBFDB1628BA0E00BC5BE2 /* dpfp_threaded.c */,
 				008FBFDC1628BA0E00BC5BE2 /* ezusb.c */,
 				008FBFDD1628BA0E00BC5BE2 /* ezusb.h */,
 				008FBFE11628BA0E00BC5BE2 /* fxload.c */,
@@ -556,11 +465,11 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				008FBF891628B7E800BC5BE2 /* libusb.h in Headers */,
 				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
 				008FBF931628B7E800BC5BE2 /* darwin_usb.h in Headers */,
 				2018D96124E453D0001589B2 /* events_posix.h in Headers */,
 				1438D77B17A2ED9F00166101 /* hotplug.h in Headers */,
-				008FBF891628B7E800BC5BE2 /* libusb.h in Headers */,
 				008FBF901628B7E800BC5BE2 /* libusbi.h in Headers */,
 				008FBF9B1628B7E800BC5BE2 /* threads_posix.h in Headers */,
 				008FBFA11628B7E800BC5BE2 /* version.h in Headers */,
@@ -568,6 +477,89 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		20951BFF25630EBE00ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0125630F4100ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0425630F7600ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C0625630F8F00ED6351 /* ezusb.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0725630F9D00ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0925630FA900ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0B25630FB400ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C0D25630FC000ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C0F25630FD300ED6351 /* libusb_testlib.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C1025630FE300ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		20951C1225630FEE00ED6351 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				008FBFA51628B84200BC5BE2 /* config.h in Headers */,
+				20951C152563125200ED6351 /* libusb.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXHeadersBuildPhase section */
 
 /* Begin PBXNativeTarget section */
@@ -575,9 +567,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 006AD4221C8C5A90007F8C6A /* Build configuration list for PBXNativeTarget "hotplugtest" */;
 			buildPhases = (
+				20951C0725630F9D00ED6351 /* Headers */,
 				006AD4181C8C5A90007F8C6A /* Sources */,
 				006AD4191C8C5A90007F8C6A /* Frameworks */,
-				006AD41A1C8C5A90007F8C6A /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -593,9 +585,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008A23D7236C8594004854AA /* Build configuration list for PBXNativeTarget "stress" */;
 			buildPhases = (
+				20951C0D25630FC000ED6351 /* Headers */,
 				008A23CF236C8594004854AA /* Sources */,
 				008A23D0236C8594004854AA /* Frameworks */,
-				008A23D1236C8594004854AA /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -611,9 +603,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FBF351628B79300BC5BE2 /* Build configuration list for PBXNativeTarget "libusb" */;
 			buildPhases = (
+				008FBF2F1628B79300BC5BE2 /* Headers */,
 				008FBF2D1628B79300BC5BE2 /* Sources */,
 				008FBF2E1628B79300BC5BE2 /* Frameworks */,
-				008FBF2F1628B79300BC5BE2 /* Headers */,
 			);
 			buildRules = (
 			);
@@ -628,9 +620,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FBFC61628B9FE00BC5BE2 /* Build configuration list for PBXNativeTarget "xusb" */;
 			buildPhases = (
+				20951C1225630FEE00ED6351 /* Headers */,
 				008FBFB91628B9FE00BC5BE2 /* Sources */,
 				008FBFBA1628B9FE00BC5BE2 /* Frameworks */,
-				008FBFBB1628B9FE00BC5BE2 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -646,9 +638,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FBFFC1628BB8C00BC5BE2 /* Build configuration list for PBXNativeTarget "dpfp" */;
 			buildPhases = (
+				20951BFF25630EBE00ED6351 /* Headers */,
 				008FBFF11628BB8B00BC5BE2 /* Sources */,
 				008FBFF21628BB8B00BC5BE2 /* Frameworks */,
-				008FBFF31628BB8B00BC5BE2 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -664,9 +656,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FC00C1628BBDB00BC5BE2 /* Build configuration list for PBXNativeTarget "dpfp_threaded" */;
 			buildPhases = (
+				20951C0125630F4100ED6351 /* Headers */,
 				008FC0011628BBDB00BC5BE2 /* Sources */,
 				008FC0021628BBDB00BC5BE2 /* Frameworks */,
-				008FC0031628BBDB00BC5BE2 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -682,9 +674,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FC01C1628BC0300BC5BE2 /* Build configuration list for PBXNativeTarget "fxload" */;
 			buildPhases = (
+				20951C0425630F7600ED6351 /* Headers */,
 				008FC0111628BC0300BC5BE2 /* Sources */,
 				008FC0121628BC0300BC5BE2 /* Frameworks */,
-				008FC0131628BC0300BC5BE2 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -700,9 +692,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 008FC02D1628BC6B00BC5BE2 /* Build configuration list for PBXNativeTarget "listdevs" */;
 			buildPhases = (
+				20951C0925630FA900ED6351 /* Headers */,
 				008FC0221628BC6B00BC5BE2 /* Sources */,
 				008FC0231628BC6B00BC5BE2 /* Frameworks */,
-				008FC0241628BC6B00BC5BE2 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -718,9 +710,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 20468D6B243298AE00650534 /* Build configuration list for PBXNativeTarget "sam3u_benchmark" */;
 			buildPhases = (
+				20951C0B25630FB400ED6351 /* Headers */,
 				20468D63243298AE00650534 /* Sources */,
 				20468D64243298AE00650534 /* Frameworks */,
-				20468D65243298AE00650534 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -736,9 +728,9 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 20468D79243298D300650534 /* Build configuration list for PBXNativeTarget "testlibusb" */;
 			buildPhases = (
+				20951C1025630FE300ED6351 /* Headers */,
 				20468D71243298D300650534 /* Sources */,
 				20468D72243298D300650534 /* Frameworks */,
-				20468D73243298D300650534 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -855,7 +847,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				008FC00F1628BBE400BC5BE2 /* dpfp_threaded.c in Sources */,
+				20951C0325630F5F00ED6351 /* dpfp.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/android/jni/examples.mk b/android/jni/examples.mk
index 74139ce..30b5c84 100644
--- a/android/jni/examples.mk
+++ b/android/jni/examples.mk
@@ -28,6 +28,7 @@
   $(LIBUSB_ROOT_REL)/examples/dpfp.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
@@ -41,12 +42,13 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-  $(LIBUSB_ROOT_REL)/examples/dpfp_threaded.c
+  $(LIBUSB_ROOT_REL)/examples/dpfp.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
-LOCAL_CFLAGS := -pthread
+LOCAL_CFLAGS := -DDPFP_THREADED -pthread
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
 
@@ -63,6 +65,7 @@
   $(LIBUSB_ROOT_REL)/examples/fxload.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
@@ -79,6 +82,7 @@
   $(LIBUSB_ROOT_REL)/examples/hotplugtest.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
@@ -95,6 +99,7 @@
   $(LIBUSB_ROOT_REL)/examples/listdevs.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
@@ -111,6 +116,7 @@
   $(LIBUSB_ROOT_REL)/examples/sam3u_benchmark.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
@@ -127,6 +133,7 @@
   $(LIBUSB_ROOT_REL)/examples/xusb.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
diff --git a/android/jni/libusb.mk b/android/jni/libusb.mk
index 656f903..dacf1ee 100644
--- a/android/jni/libusb.mk
+++ b/android/jni/libusb.mk
@@ -24,9 +24,6 @@
 
 include $(CLEAR_VARS)
 
-LIBUSB_ROOT_REL := ../..
-LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
-
 LOCAL_SRC_FILES := \
   $(LIBUSB_ROOT_REL)/libusb/core.c \
   $(LIBUSB_ROOT_REL)/libusb/descriptor.c \
diff --git a/android/jni/tests.mk b/android/jni/tests.mk
index 6136f58..b42bd1c 100644
--- a/android/jni/tests.mk
+++ b/android/jni/tests.mk
@@ -29,6 +29,7 @@
   $(LIBUSB_ROOT_REL)/tests/testlib.c
 
 LOCAL_C_INCLUDES += \
+  $(LOCAL_PATH)/.. \
   $(LIBUSB_ROOT_ABS)
 
 LOCAL_SHARED_LIBRARIES += libusb1.0
diff --git a/examples/dpfp.c b/examples/dpfp.c
index cbbfc8d..f05fa08 100644
--- a/examples/dpfp.c
+++ b/examples/dpfp.c
@@ -35,31 +35,42 @@
 
 #if defined(DPFP_THREADED)
 #if defined(PLATFORM_POSIX)
+#include <fcntl.h>
 #include <pthread.h>
 #include <semaphore.h>
+#include <unistd.h>
 
 #define THREAD_RETURN_VALUE	NULL
-typedef sem_t semaphore_t;
+typedef sem_t * semaphore_t;
 typedef pthread_t thread_t;
 
-static inline int semaphore_init(semaphore_t *semaphore)
+static inline semaphore_t semaphore_create(void)
 {
-	return sem_init(semaphore, 0, 0);
+	sem_t *semaphore;
+	char name[50];
+
+	sprintf(name, "/org.libusb.example.dpfp_threaded:%d", (int)getpid());
+	semaphore = sem_open(name, O_CREAT | O_EXCL, 0, 0);
+	if (semaphore == SEM_FAILED)
+		return NULL;
+	/* Remove semaphore so that it does not persist after process exits */
+	(void)sem_unlink(name);
+	return semaphore;
 }
 
-static inline void semaphore_give(semaphore_t *semaphore)
+static inline void semaphore_give(semaphore_t semaphore)
 {
 	(void)sem_post(semaphore);
 }
 
-static inline void semaphore_take(semaphore_t *semaphore)
+static inline void semaphore_take(semaphore_t semaphore)
 {
 	(void)sem_wait(semaphore);
 }
 
-static inline void semaphore_destroy(semaphore_t *semaphore)
+static inline void semaphore_destroy(semaphore_t semaphore)
 {
-	(void)sem_destroy(semaphore);
+	(void)sem_close(semaphore);
 }
 
 static inline int thread_create(thread_t *thread,
@@ -84,26 +95,24 @@
 typedef unsigned thread_return_t;
 #endif
 
-static inline int semaphore_init(semaphore_t *semaphore)
+static inline semaphore_t semaphore_create(void)
 {
-	*semaphore = CreateSemaphore(NULL, 0, 1, NULL);
-	return *semaphore != NULL ? 0 : -1;
+	return CreateSemaphore(NULL, 0, 1, NULL);
 }
 
-static inline void semaphore_give(semaphore_t *semaphore)
+static inline void semaphore_give(semaphore_t semaphore)
 {
-	(void)ReleaseSemaphore(*semaphore, 1, NULL);
+	(void)ReleaseSemaphore(semaphore, 1, NULL);
 }
 
-static inline void semaphore_take(semaphore_t *semaphore)
+static inline void semaphore_take(semaphore_t semaphore)
 {
-	(void)WaitForSingleObject(*semaphore, INFINITE);
+	(void)WaitForSingleObject(semaphore, INFINITE);
 }
 
-static inline void semaphore_destroy(semaphore_t *semaphore)
+static inline void semaphore_destroy(semaphore_t semaphore)
 {
-	(void)CloseHandle(*semaphore);
-	*semaphore = NULL;
+	(void)CloseHandle(semaphore);
 }
 
 static inline int thread_create(thread_t *thread,
@@ -170,7 +179,7 @@
 {
 	do_exit = code;
 #if defined(DPFP_THREADED)
-	semaphore_give(&exit_semaphore);
+	semaphore_give(exit_semaphore);
 #endif
 }
 
@@ -605,7 +614,6 @@
 		goto out_deinit;
 
 	/* async from here onwards */
-
 	setup_signals();
 
 	r = alloc_transfers();
@@ -613,15 +621,15 @@
 		goto out_deinit;
 
 #if defined(DPFP_THREADED)
-	r = semaphore_init(&exit_semaphore);
-	if (r < 0) {
+	exit_semaphore = semaphore_create();
+	if (!exit_semaphore) {
 		fprintf(stderr, "failed to initialise semaphore\n");
 		goto out_deinit;
 	}
 
 	r = thread_create(&poll_thread, poll_thread_main, NULL);
 	if (r) {
-		semaphore_destroy(&exit_semaphore);
+		semaphore_destroy(exit_semaphore);
 		goto out_deinit;
 	}
 
@@ -630,7 +638,7 @@
 		request_exit(2);
 
 	while (!do_exit)
-		semaphore_take(&exit_semaphore);
+		semaphore_take(exit_semaphore);
 #else
 	r = init_capture();
 	if (r < 0)
@@ -647,7 +655,7 @@
 
 #if defined(DPFP_THREADED)
 	thread_join(poll_thread);
-	semaphore_destroy(&exit_semaphore);
+	semaphore_destroy(exit_semaphore);
 #endif
 
 	if (img_transfer) {
diff --git a/examples/sam3u_benchmark.c b/examples/sam3u_benchmark.c
index 5cc4065..33e8913 100644
--- a/examples/sam3u_benchmark.c
+++ b/examples/sam3u_benchmark.c
@@ -64,7 +64,7 @@
 
 	(void)clock_gettime(CLOCK_MONOTONIC, &ts);
 	tv->tv_sec = ts.tv_sec;
-	tv->tv_usec = ts.tv_nsec / 1000L;
+	tv->tv_usec = (int)(ts.tv_nsec / 1000L);
 #else
 	gettimeofday(tv, NULL);
 #endif
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 047bfa8..593d086 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11575
+#define LIBUSB_NANO 11576