summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-08-16 22:56:59 (GMT)
committerUwe Hermann <uwe@hermann-uwe.de>2014-08-17 21:37:13 (GMT)
commit9eb8968dde0d2e8f9fdb1a65f3e3da236d99fc71 (patch)
tree46e971a06d0baaeb2a0bf99575d6310f708e4f13
parent43c468b8ef03f12dad9c0fb7d0f85c4f3afe3d82 (diff)
downloadmxe-9eb8968dde0d2e8f9fdb1a65f3e3da236d99fc71.zip
mxe-9eb8968dde0d2e8f9fdb1a65f3e3da236d99fc71.tar.gz
mxe-9eb8968dde0d2e8f9fdb1a65f3e3da236d99fc71.tar.bz2
libftdi1: add test file
-rw-r--r--src/libftdi1-test.c38
-rw-r--r--src/libftdi1.mk5
2 files changed, 43 insertions, 0 deletions
diff --git a/src/libftdi1-test.c b/src/libftdi1-test.c
new file mode 100644
index 0000000..8252cf3
--- /dev/null
+++ b/src/libftdi1-test.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <stdio.h>
+#include <ftdi.h>
+
+int main(int argc, char *argv[])
+{
+ int num_devs;
+ struct ftdi_context *ctx;
+ struct ftdi_device_list *devs = NULL;
+
+ (void)argc;
+ (void)argv;
+
+ ctx = ftdi_new();
+ if (!ctx) {
+ printf("Initialization error.\n");
+ return 1;
+ }
+
+ num_devs = ftdi_usb_find_all(ctx, &devs, 0, 0);
+ if (num_devs < 0) {
+ printf("Device list error: %s.\n", ftdi_get_error_string(ctx));
+ ftdi_free(ctx);
+ return 2;
+ }
+
+ printf("Found %d FTDI devices.\n", (int)num_devs);
+
+ ftdi_list_free(&devs);
+
+ ftdi_free(ctx);
+
+ return 0;
+}
diff --git a/src/libftdi1.mk b/src/libftdi1.mk
index 7b18986..7849680 100644
--- a/src/libftdi1.mk
+++ b/src/libftdi1.mk
@@ -22,6 +22,11 @@ define $(PKG)_BUILD
-DCMAKE_BUILD_TYPE=Release \
-DLIBUSB_INCLUDE_DIR=$(PREFIX)/$(TARGET)/include/libusb-1.0
$(MAKE) -C '$(1)' -j '$(JOBS)' install VERBOSE=1
+
+ '$(TARGET)-gcc' \
+ -W -Wall -Wextra -Werror \
+ '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libftdi1.exe' \
+ `'$(TARGET)-pkg-config' libftdi1 --cflags --libs`
endef
$(PKG)_BUILD_SHARED =