From 6eb8ba8c5bb7fed60c706f76e3918a631851c493 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Wed, 18 Nov 2015 13:44:50 +0100 Subject: [PATCH] make HIDAPI link more robust add fido u2f --- plugins/bcs-usb/hidapi.pri | 34 ++++++++++++++++++++++++++-------- plugins/fido-u2f/fido-u2f.pro | 18 ++++++++++++++++++ plugins/plugins.pro | 2 +- 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 plugins/fido-u2f/fido-u2f.pro diff --git a/plugins/bcs-usb/hidapi.pri b/plugins/bcs-usb/hidapi.pri index 9b0ba28..83bca94 100644 --- a/plugins/bcs-usb/hidapi.pri +++ b/plugins/bcs-usb/hidapi.pri @@ -4,17 +4,35 @@ HIDAPIDIR = $$PWD/../../hidapi INCLUDEPATH += $$HIDAPIDIR/hidapi -linux { - SOURCES += $$HIDAPIDIR/libusb/hid.c - CONFIG += link_pkgconfig - PKGCONFIG += libusb-1.0 -} -win32 { +CONFIG += link_pkgconfig + +packagesExist(hidapi-hidraw) { + PKGCONFIG += hidapi-hidraw + message("Pkg-Config: using HIDAPI with HIDraw interface") +} else { + packagesExist(hidapi) { + PKGCONFIG += hidapi + message("Pkg-Config: using HIDAPI with default interface") + } else { + packagesExist(hidapi-libusb) { + PKGCONFIG += hidapi-libusb + message("Pkg-Config: using HIDAPI with libusb interface") + } else { + linux { + SOURCES += $$HIDAPIDIR/linux/hid.c + message("Using built-in HIDAPI for Linux") + } + win32 { SOURCES += $$HIDAPIDIR/windows/hid.c LIBS += -lsetupapi -} -mac { + message("Using built-in HIDAPI for Windows") + } + mac { SOURCES += $$HIDAPIDIR/mac #from mac/Makefile-manual, not sure how to use this: #LIBS += -framework IOKit -framework CoreFoundation + message("Using built-in HIDAPI for MacOS/X") + } + } + } } diff --git a/plugins/fido-u2f/fido-u2f.pro b/plugins/fido-u2f/fido-u2f.pro new file mode 100644 index 0000000..808c115 --- /dev/null +++ b/plugins/fido-u2f/fido-u2f.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +TARGET = msp-fido-u2f +CONFIG += plugin no_plugin_name_prefix + +include (../../basics.pri) +include (../../src/smoke.pri) + +#SOURCES += bcs-plugin.cpp configwidget.cpp bcskeyboard.cpp hidscanner.cpp +#HEADERS += bcs-plugin.h configwidget.h bcskeyboard.h hidscanner.h + +CONFIG += link_pkgconfig + +packagesExist(u2f-host u2f-server) { + PKGCONFIG += u2f-host u2f-server + message("Pkg-Config: U2F libs found") +} else { + error("Pkg-Config: U2F libs not found!") +} diff --git a/plugins/plugins.pro b/plugins/plugins.pro index 88a3553..c7f19dc 100644 --- a/plugins/plugins.pro +++ b/plugins/plugins.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = bcs-usb \ No newline at end of file +SUBDIRS = bcs-usb fido-u2f -- 1.7.2.5