-
Notifications
You must be signed in to change notification settings - Fork 465
Add hidraw backend for FreeBSD #730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aokblast
wants to merge
3
commits into
libusb:master
Choose a base branch
from
aokblast:use_hid_raw
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| Debug | ||
| Release | ||
| *.exp | ||
| *.ilk | ||
| *.lib | ||
| *.suo | ||
| *.vcproj.* | ||
| *.ncb | ||
| *.suo | ||
| *.dll | ||
| *.pdb | ||
| *.o | ||
| *.so | ||
| hidtest-hidraw | ||
| .deps | ||
| .libs | ||
| *.lo | ||
| *.la |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR) | ||
|
|
||
| add_library(hidapi_hidraw | ||
| ${HIDAPI_PUBLIC_HEADERS} | ||
| hid.c | ||
| ) | ||
| target_link_libraries(hidapi_hidraw PUBLIC hidapi_include) | ||
|
|
||
| find_package(Threads REQUIRED) | ||
|
|
||
| include(FindPkgConfig) | ||
| pkg_check_modules(libusb-1.0 REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9) | ||
|
|
||
| target_link_libraries(hidapi_hidraw PRIVATE PkgConfig::libusb-1.0 Threads::Threads) | ||
|
|
||
| set_target_properties(hidapi_hidraw | ||
| PROPERTIES | ||
| EXPORT_NAME "hidraw" | ||
| OUTPUT_NAME "hidapi-hidraw" | ||
| VERSION ${PROJECT_VERSION} | ||
| SOVERSION ${PROJECT_VERSION_MAJOR} | ||
| PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}" | ||
| ) | ||
|
|
||
| # compatibility with find_package() | ||
| add_library(hidapi::hidraw ALIAS hidapi_hidraw) | ||
| # compatibility with raw library link | ||
| add_library(hidapi-hidraw ALIAS hidapi_hidraw) | ||
|
|
||
| if(HIDAPI_INSTALL_TARGETS) | ||
| install(TARGETS hidapi_hidraw EXPORT hidapi | ||
| LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
| ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
| PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/hidapi" | ||
| ) | ||
| endif() | ||
|
|
||
| hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi-hidraw.pc.in") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| ########################################### | ||
| # Simple Makefile for HIDAPI test program | ||
| # | ||
| # Alan Ott | ||
| # Signal 11 Software | ||
| # 2010-06-01 | ||
| ########################################### | ||
|
|
||
| all: hidtest-hidraw libs | ||
|
|
||
| libs: libhidapi-hidraw.so | ||
|
|
||
| CC ?= gcc | ||
| CFLAGS ?= -Wall -g -fpic | ||
|
|
||
| LDFLAGS ?= -Wall -g | ||
|
|
||
|
|
||
| COBJS = hid.o ../hidtest/test.o | ||
| OBJS = $(COBJS) | ||
| LIBS_USB = `pkg-config libusb-1.0 --libs` | ||
| LIBS = $(LIBS_USB) | ||
| INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags` | ||
|
|
||
|
|
||
| # Console Test Program | ||
| hidtest-hidraw: $(COBJS) | ||
| $(CC) $(LDFLAGS) $^ $(LIBS_USB) -o $@ | ||
|
|
||
| # Shared Libs | ||
| libhidapi-hidraw.so: $(COBJS) | ||
| $(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@ | ||
|
|
||
| # Objects | ||
| $(COBJS): %.o: %.c | ||
| $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ | ||
|
|
||
|
|
||
| clean: | ||
| rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so $(COBJS) | ||
|
|
||
| .PHONY: clean libs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| lib_LTLIBRARIES = libhidapi-hidraw.la | ||
| libhidapi_hidraw_la_SOURCES = hid.c | ||
| libhidapi_hidraw_la_LDFLAGS = $(LTLDFLAGS) | ||
| AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_HIDRAW) | ||
| libhidapi_hidraw_la_LIBADD = $(LIBS_HIDRAW) | ||
|
|
||
| hdrdir = $(includedir)/hidapi | ||
| hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h | ||
|
|
||
| EXTRA_DIST = Makefile-manual |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg_check_modules(libusb-1.0 ...)uses a prefix containing a hyphen, which is not a valid CMake identifier and typically breaksFindPkgConfig(it tries to create variables/targets likelibusb-1.0_*). Follow the pattern inlibusb/CMakeLists.txtand use a valid prefix (e.g.libusb) and linkPkgConfig::libusb.