summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-11-25 13:47:06 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-11-26 00:59:31 +0100
commit46f83a033f14400d7f06f684bb1e4a604a41cfe5 (patch)
tree1f3302f02a7f6aff2e08b5b6193ee7822f7581fa
parent2a0cac2b42418944cb9b054a462daa20bd7b76d1 (diff)
downloadusb-drivers-46f83a033f14400d7f06f684bb1e4a604a41cfe5.tar.gz
usb-drivers-46f83a033f14400d7f06f684bb1e4a604a41cfe5.tar.xz
usb-drivers-46f83a033f14400d7f06f684bb1e4a604a41cfe5.zip
Improve OpenBSD build compatibility
It still doesn't build, though, because 7.6 doesn't have 0.14 yet.
-rw-r--r--CMakeLists.txt8
-rw-r--r--README.adoc2
-rw-r--r--eizoctl.c4
3 files changed, 11 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e4ddd3..79c8d95 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/liberty/cmake)
find_package (PkgConfig REQUIRED)
pkg_check_modules (libusb libusb-1.0)
-pkg_search_module (hidapi hidapi hidapi-hidraw)
+pkg_search_module (hidapi hidapi hidapi-hidraw hidapi-libusb)
option (WITH_LIBUSB "Compile with libusb-based utilities" ${libusb_FOUND})
option (WITH_HIDAPI "Compile with hidapi-based utilities" ${hidapi_FOUND})
@@ -57,9 +57,13 @@ elseif (APPLE)
endif ()
if (WITH_LIBUSB AND NOT WIN32)
+ # -liconv may or may not be a part of libc
+ find_path (iconv_INCLUDE_DIRS iconv.h)
+
list (APPEND targets elksmart-comm)
add_executable (elksmart-comm elksmart-comm.c)
- target_include_directories (elksmart-comm PUBLIC ${libusb_INCLUDE_DIRS})
+ target_include_directories (elksmart-comm
+ PUBLIC ${libusb_INCLUDE_DIRS} ${iconv_INCLUDE_DIRS})
target_link_directories (elksmart-comm PUBLIC ${libusb_LIBRARY_DIRS})
target_link_libraries (elksmart-comm ${libusb_LIBRARIES})
endif ()
diff --git a/README.adoc b/README.adoc
index 255dfed..174da0e 100644
--- a/README.adoc
+++ b/README.adoc
@@ -34,7 +34,7 @@ Building
Build dependencies:
CMake, pkg-config, liberty (included), help2man +
Runtime dependencies:
- libusb-1.0 (elksmart-comm, razer-bw-te-ctl), hidapi (eizoctl)
+ libusb-1.0 (elksmart-comm, razer-bw-te-ctl), hidapi >= 0.14 (eizoctl)
$ git clone --recursive https://git.janouch.name/p/usb-drivers.git
$ mkdir usb-drivers/build
diff --git a/eizoctl.c b/eizoctl.c
index 7dc468d..eadb1e0 100644
--- a/eizoctl.c
+++ b/eizoctl.c
@@ -37,6 +37,10 @@
#undef PROGRAM_NAME
#define PROGRAM_NAME "eizoctl"
+#ifdef __OpenBSD__
+#define hid_init hidapi_hid_init
+#endif
+
#if defined __GNUC__
#define ATTRIBUTE_PRINTF(x, y) __attribute__((format(printf, x, y)))
#else