Commit Graph

465 Commits

Author SHA1 Message Date
Vitaly Samoylik 8ed36853ba Read podspec version from VERSION file (#205)
* Read podspec version from VERSION file
* Add AppKit dependency into podspec
2020-10-26 17:34:15 +02:00
Ihor Dutchak 302d1f2401 Fire v0.10.0 hidapi-0.10.0 2020-10-25 23:59:59 +02:00
Ihor Dutchak a11a5e71c8 explicitly install required packages for archlinux CI builds 2020-10-25 23:59:24 +02:00
Marc Zyngier ad985aeaf4 linux/hidraw: Don't consider open returning 0 as an error
The open systcall is allowed to return 0 as a valid file descriptor,
and considering it an error breaks environments where unnecessary
fds are closed before executing untrusted processes.

Fixes: #199

Signed-off-by: Marc Zyngier <maz@kernel.org>
2020-10-20 19:01:54 +03:00
Ihor Dutchak 3fe9b78d6d ignore .DS_Store files 2020-10-16 13:06:50 +03:00
Ihor Dutchak a731aae2a3 macOS: fix -Wall -Wextra -pedantic compilation warnings 2020-10-16 13:06:50 +03:00
Ihor Dutchak d2c3a9862e libusb: fix race condition on device close (#189)
Read callback may fire itself on its own even after its been
requested to stop and exactly before the calling code
waits for its completion in indefinite loop.

Explicitly preventing re-fireing the submission loop,
fixes the issue.

Fixes: #142.

Signed-off-by: Ihor Dutchak <ihor.youw@gmail.com>
2020-10-14 18:43:26 +03:00
Ihor Dutchak 2eb8af161f MSVC: fix /W4 /WX compilation (#191) 2020-10-14 18:42:27 +03:00
Ihor Dutchak 8f72236099 add hid_version/hid_version_str API (#192)
- API functions to get runtime version of the library;
- macros to get static/compile-time version of the library;
- VERSION file;
2020-10-14 18:41:08 +03:00
Ihor Dutchak fd53f39f25 macOS: enumerate device with primary usage/usage_page first (#193)
It improves backward compatibility with versions of hidapi, where
usage/usage_pairs didn't emit seaprate hid_devices_info.
2020-10-14 18:37:27 +03:00
Kevin Teynor b1a2628eea Windows: crash bugfix when trying to open device without a serial number (#194) 2020-10-14 18:36:12 +03:00
Ihor Dutchak cdc473dfe4 Don't leak device handle in macOS 10.10 or newer (#186)
In one of the early versions of macOS, when you try to close the device
with IOHIDDeviceClose() that is being physically disconnected.
Starting with some version of macOS, this crash bug was fixed,
and starting with macSO 10.15 the opposite effect took place:
in some environments crash happens if IOHIDDeviceClose() is _not_ called.

This patch is to keep a workaround for old versions of macOS,
and don't have a leak in new/tested environments.

Fixes: #144.
2020-09-29 14:01:30 +03:00
UweBonnes 8a88108a49 windows/hid.c: Silence some warnings. (#181) 2020-09-27 18:22:45 +03:00
Cristian GLAVANA f7c7f97d09 Windows Handle GetOverlappedResult blocking on read/write (#129)
- Implemented solution from issue signal11/hidapi#88
- Allows read/write frames up to 1000 per second
2020-09-22 15:21:16 +03:00
Stanley Pinchak ad27b46170 FIX Compiler Warnings on Windows
- cast hidapi supplied size_t parameters to DWORD when calling Windows
  API functions
- cast size_t return variables in `hid_read_timeout` and
  `hid_send_feature_report` to int in order to match hidapi signature.
2020-08-13 19:12:07 +03:00
Pavel Hübner 24a822c80f Fix compilation warning in pedantic mode on macOS
The compiler provided the following warning message:
```
hid.c:830:29: warning: format specifies type 'void *' but the argument has type 'IOHIDDeviceRef' (aka 'struct __IOHIDDevice *') [-Wformat-pedantic]
                sprintf(str, "HIDAPI_%p", dev->device_handle);
                                     ~~   ^~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
```
2020-03-20 01:43:44 +02:00
Luca Weiss 30c46ad876 testgui: ensure $EXEPATH is a directory
Otherwise hidapi-testgui will be put at TestGUI.app/Contents/MacOS which
results in a malformed .app structure.

The following build combinations have been tested:
* 'make -f Makefile-manual' with libtool
* 'make -f Makefile-manual' without libtool
* './configure --enable-testgui && make'

Fixes #151
2020-03-08 19:40:48 +02:00
CodeforEvolution f2611e0237 Changes to Build System for Haiku
Co-authored-by: @CodeforEvolution
Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
Co-authored-by: Begasus <begasus@gmail.com>
Co-authored-by: Panagiotis Vasilopoulos <hello@alwayslivid.com>
2020-02-12 17:00:07 +02:00
wet34t 533dd9229a libusb: allow hidapi to be configured without using iconv 2020-02-09 15:22:22 +02:00
Jonas Malaco 2dd94af2ea Move local variable declaration to the beginning of the function
Older versions of MSVC (for example when using Visual Studio 10) don't
yet support variable declaration in the middle of blocks:

hidapi\windows\hid.c(845) : error C2275: 'BOOL' : illegal use of this type as an expression
        C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(153) : see declaration of 'BOOL'

Move the declaration of res to the beginning of the function.  Like in
hid_get_feature_report, only res is moved, essentially ignoring the #if
0 block (or assuming it will never be enabled).
2020-02-09 15:15:43 +02:00
Ed Maste d38dbd2e99 Add .cirrus.yml config for Cirrus-CI (#15)
Configure with Alpine, FreeBSD 11 and 12 tasks
2020-01-22 16:01:51 +02:00
Fredrik Fornwall 90ddfc61b7 Fix build when targetting Android 7 or later
Support for pthread_barrier was introduced in Android 7, so trying to
build a custom implementation of that clashes with the system headers.
2020-01-22 14:05:08 +02:00
Luca Weiss 51bdec7844 Fix manual Makefiles and add CI for them (#131) 2020-01-12 04:09:48 +02:00
0xDP 65d22a9c31 macOS: correct IOKit framework location (#120) 2019-12-07 18:54:07 +02:00
Tod E. Kurt ca1a2d6efa macOS support for multiple usage/usage-pages (#125)
* macOS support for multiple usage/usage-pages
Update of @fengji2006 PR#65, second try

* apply requested changes and test

* handle possible nullptr
2019-12-05 10:53:44 -08:00
Daniel Van Noord 083223e779 Added support for Get Input Report (#59)
- Get Input Report supported on linux/libusb, mac and windows;
- linux/hidraw doesn't support it on kernel level;
2019-11-15 13:55:51 +02:00
Filip Kubicz 7e91963917 Update README.md
Co-Authored-By: Ihor Dutchak <ihor.youw@gmail.com>
2019-11-05 14:21:21 +01:00
Filip Kubicz 40de5a638b README: add hid_close() to the code sample 2019-11-05 14:21:21 +01:00
Filip Kubicz 1750cc8373 README: Add warning about writing data to HID products
In response to https://github.com/libusb/hidapi/issues/105
2019-11-05 14:21:21 +01:00
Ludovic Rousseau faaf22cba2 Windows: fix build of hidtest 2019-11-05 14:00:44 +01:00
Ludovic Rousseau 8184eb2087 Linux: fix Makefile-manual to build hidtest 2019-11-05 14:00:44 +01:00
Ludovic Rousseau 3cea631d43 macOS: fix Makefile-manual to build hidtest 2019-11-05 14:00:44 +01:00
Ludovic Rousseau c1b3078251 macOS: fix build of hidtest using autotools
Fix github issue #114
2019-11-05 14:00:44 +01:00
Mayank Suman fa75ffb743 Reattach kernel driver in hidapi-libusb 2019-10-31 12:56:00 +02:00
Josep Maria Antolín Segura dd16e7c16f Fix uninitialized strings on Windows (#109)
Fix for unusual cases where the hardware does not return the name and the string is not initialized at all.
2019-10-28 16:23:24 +02:00
Vitaly Samoylik 7d93b430a9 Fixed tag name for hidapi releases 2019-10-06 18:36:51 +02:00
Ihor Dutchak d64f6c6a16 macOS: send report id conditionally for hid_get_feature_report (#70)
same as in hid_send_feature_report, and Windows/Linux
2019-09-24 13:34:59 +03:00
Josh Junon d8b6588d09 mac: prevent memory leak in hid_open_path() if hid_init() fails 2019-09-24 13:25:23 +03:00
Vitaly Samoylik 3811f0da8d Added podspec to support releases via cocoapods (#66) 2019-09-13 15:55:01 +03:00
Luca Weiss fc677b8195 configure.ac: Use pkg-config to find libusb on *freebsd 2019-08-30 10:23:23 +02:00
Luca Weiss 9b1a3e8947 builds/freebsd: Install pkgconf 2019-08-30 10:23:23 +02:00
Ihor Dutchak 4c33f69712 AUTHORS: add libusb/hidapi Team mention 2019-08-30 10:21:06 +02:00
Filip Kubicz 651150d8b5 README: add CI build badges
Show status of test builds on the project GitHub page.
Fixes #35.

Signed-off-by: Filip Kubicz <filip@kubicz.engineer>
2019-07-25 08:13:11 +02:00
Andrew Eikum 5d9b4cd93c Zero-initialize new hid_device_info structs
This fixes an uninitialized usage_page value leaking from the Linux
backend. It may fix other uninitialized values, too.
2019-07-25 08:08:12 +02:00
Andrew Eikum 93dca80762 Update more repository URLs 2019-07-25 07:57:59 +02:00
Ihor Dutchak e4ad5ec64f Update README: hidraw: minimum supported kernel 2019-07-23 23:50:56 +03:00
Luca Weiss ecade8c6fd testgui: fix incompatible pointer warning
mac_support_cocoa.m:67:49: warning: incompatible pointer types sending 'MyAppDelegate *' to parameter of type
      'id<NSApplicationDelegate> _Nullable' [-Wincompatible-pointer-types]
        [[NSApplication sharedApplication] setDelegate:d];
                                                       ^
2019-07-23 22:31:03 +02:00
Luca Weiss 04a1789710 testgui: fix deprecation warning
mac_support_cocoa.m:80:49: warning: 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
                NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
                                                              ^~~~~~~~~~~~~~
                                                              NSEventMaskAny
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:158:26: note:
      'NSAnyEventMask' has been explicitly marked deprecated here
static const NSEventMask NSAnyEventMask                 NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSEventMaskAny", 10_0, 10_12) = NSUIntegerMax;
                         ^
2019-07-23 22:31:03 +02:00
Luca Weiss a1d49824ea testgui: remove obsolete files
mac_support.cpp is unused since commit bab22b7 and start.sh is the
original authors custom start script that we don't want.
2019-07-23 22:14:10 +03:00
Luca Weiss 065d46ab27 Add Windows (msbuild & cygwin) CI (#37)
* Upgrade Windows projects to VS2015
* add MSVC x64 configuration
2019-07-17 20:14:38 +03:00