Commit Graph

340 Commits

Author SHA1 Message Date
Alan Ott 2e4835471c Windows: Add a 1 second timeout to hid_write() 2012-11-28 11:28:28 -05:00
Ludovic Rousseau 0d7c7ef066 libusb: remove extra spaces
Remove spaces and tabs at end of lines.
2012-11-28 10:33:43 -05:00
Ludovic Rousseau ec24f93100 all: make hid_enumerate() able to match any vendor or any product
Passing product_id=0 will match any product of a given vendor.  This patch
makes it also possible to use vendor_id=0 to match any vendor for a given
product id.

Windows code added to Ludovic's patch by Alan Ott.
2012-11-27 22:12:35 -05:00
Alan Ott b20777fc0c testgui: more robust handling of report length fields
Improve logic of report length field handling for empty fields.
Add column headers for data and length fields.
Add documentation statement about length fields.
Increase window size.
Add message boxes when invalid values are entered.
memset() buffers to zero.
2012-11-26 22:27:24 -05:00
Michael Pisarski 1fba3f98f0 testgui: Add fields for lengths of reports
Windows platforms return errors When you do not specify the proper buffer
size and length.
2012-11-26 22:27:24 -05:00
Nikolaj Løbner Sheller 0ed94093c8 windows: replace magic number 2 with sizeof(wchar_t)
Changed for readability, as I think this is what was intended by
the author.
2012-11-26 20:30:09 -05:00
Alan Ott c6f2900275 Merge branch 'master' of github.com:signal11/hidapi 2012-11-26 20:20:43 -05:00
Justin R. Cutler b0e2fb8d35 libusb/mac: gcc -pedantic warning fixes 2012-11-26 20:20:13 -05:00
Justin R. Cutler b5b15d0d83 windows: mingw: minor gcc -pedantic warning fixes 2012-11-26 20:00:48 -05:00
Justin R. Cutler 69a91a8f6c All: Convert C99 comments (//) into C89 comments (/* */) 2012-11-26 18:49:51 -05:00
Justin R. Cutler 3bfaffbfe0 linux: fix gcc warnings when INVASIVE_GET_USAGE is defined. 2012-11-26 15:29:01 -05:00
Stan Hu d5710b4f96 linux: Fix memory leaks on serial number and product name
In get_device_string() serial_number_utf8 and product_name_utf8 could end
up not getting freed if certain errors occurred.
2012-11-26 15:07:51 -05:00
Stan Hu 1774c81f04 linux: check for EINPROGRESS from read()
Non-blocking I/O can cause read() to return EINPROGRESS in addition to
EAGAIN.  Handle this case.
2012-11-26 15:03:10 -05:00
Stan Hu 901fbe9e39 mac: Use Location ID in make_path instead of pointers
Using locations makes the path the same for each run of a HIDAPI based
program.  This is useful for opening devices which don't have a serial
number, and where multiple devices of the same type are attached to the
system at once.

This references pull request #78.
2012-11-26 14:31:17 -05:00
Alan Ott dc6c170672 mac: Fix string handling
There were errors regarding the length of strings in conversion from CFString
to wchar_t.

Thanks to github user nikolajsheller for pointing this out in pull request #80.
2012-11-26 13:59:33 -05:00
Ludovic Rousseau 54d32f6aa3 mac: Use exclusivce device access
Use kIOHIDOptionsTypeSeizeDevice instead of kIOHIDOptionsTypeNone to
avoid interferences with other applications trying to use the HID device
at the same time.
2012-11-26 13:35:12 -05:00
Ludovic Rousseau f74e0c64e8 hidtest: Use hid_init()
Use hid_init() in hidtest/hidtest.cpp
2012-11-26 13:34:54 -05:00
Ludovic Rousseau e569477ef1 README.txt: Improve sample code
- use hid_init()/hid_exit()
- include windows.h only on Windows
2012-11-26 11:21:55 -05:00
Ludovic Rousseau 1826eabaef linux/hidraw: Fix compiler warning
hid.c: In function 'uses_numbered_reports':
hid.c:126:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
hid.c:143:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2012-11-26 11:21:42 -05:00
Ludovic Rousseau 85d608e80e Linux: Fix warning: function declaration isn't a prototype
linux/hid.c:83:13: warning: function declaration isn't a prototype [-Wstrict-prototypes]
linux/hid.c: In function 'new_hid_device':
linux/hid.c:83:13: warning: old-style function definition [-Wold-style-definition]
2012-09-21 10:51:34 -04:00
Ludovic Rousseau 8def28f09d Mac, Linux: Remove extra spaces at end of lines 2012-09-21 10:51:26 -04:00
Ludovic Rousseau 5d2b6b8eab Mac: Fix warning: function declaration isn't a prototype
hid.c:386: warning: function declaration isn't a prototype
2012-09-21 10:51:15 -04:00
Ludovic Rousseau c279c1d25b Linux: Fix warning: comparison between signed and unsigned
mbstowcs() returns a size_t not an int.

hid.c: In function 'get_device_string':
hid.c:285:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
hid.c:289:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
hid.c:318:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2012-09-21 10:49:22 -04:00
Ludovic Rousseau bfb2b5924d Linux: Remove unused function register_error()
Fix compiler warning
hid.c:93:13: warning: 'register_error' defined but not used [-Wunused-function]
2012-09-21 10:49:09 -04:00
Ludovic Rousseau 61757847c4 Linux: Fix warning: enumeration value not handled in switch
hid.c:282:5: warning: enumeration value 'DEVICE_STRING_COUNT' not handled in switch [-Wswitch-enum]
2012-09-21 10:49:03 -04:00
Ludovic Rousseau 6761e3f5ba Linux: Fix warning: no previous prototype
hid.c:190:1: warning: no previous prototype for 'parse_uevent_info' [-Wmissing-prototypes]
2012-09-21 10:48:54 -04:00
Ludovic Rousseau 367fc3f3aa linux: Fix bug on mbstowcs() usage
In case of error mbstowcs() returns (size_t) -1
It is not a negative value since mbstowcs() returns a size_t (unsigned)

Fix compiler warning:
hid.c: In function 'utf8_to_wchar_t':
hid.c:105:3: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
2012-09-21 10:48:36 -04:00
Brendan Shanks ee808f9dfc Mac: Remove 'next' from struct hid_device_
Remove 'next' from struct hid_device_, it's unused since device_list was
removed
2012-09-17 21:25:09 -04:00
Brendan Shanks 471dd9d5ae Mac: Remove device_list and its mutex/code
Remove device_list, which was used to match up IOHIDDeviceRef's and
hid_device's in the device removal callback. This was needed because the
removal callback was attached to the whole IOHIDManager, instead of
individual IOHIDDevices.
Instead attach the removal callback to each IOHIDDevice individually,
and have a pointer to the device's hid_device passed to the callback.
2012-09-17 21:25:08 -04:00
Peter Stuge 399e4fad12 configure.ac: Reduce required autoconf version to 2.63 which also works 2012-08-14 22:34:29 -04:00
Peter Stuge 8cd443954c README: Use $HOST also in the "Build libudev" configure command 2012-08-14 22:34:18 -04:00
Alan Ott 425ef9f86e udev: Insert comment about case-sensitivity
VID/PID (hex) are case sensitive.
2012-07-30 10:51:51 -04:00
Thomas Perl 807afbc35c Linux: Fix return value handling of mbstowcs() 2012-07-17 22:31:05 -04:00
Alan Ott 48352615f0 Linux: Small refactoring of Thomas's previous patch 2012-07-17 22:31:05 -04:00
Thomas Perl 36f7dec134 linux/hid.c: Fix enumeration for Bluetooth devices 2012-07-16 01:09:13 -04:00
Alan Ott 44f9df5ec1 Windows: Make sure a driver is present for enumeration.
Windows will enumerate a device before the driver has been attached to
that device. This is problematic, and causes hangups on Windows 7
(possibly othes) when the device is opened before a driver is attached
and then closed. This patch makes sure that a driver has been attached
to the device before putting it in the enumeration list.
2012-07-16 13:02:32 +08:00
Alex Dupre 645a0c357a FreeBSD: Conditionally remove calls to libusb_detach_kernel_driver()
libusb_detach_kernel_driver() is not needed on FreeBSD.
2012-07-16 00:52:43 -04:00
Alex Dupre 49021efd0f FreeBSD: Add $(LIBS) to libhidapi.so target (Makefile.freebsd) 2012-07-16 00:52:17 -04:00
Alan Ott 6d50f8fa0f Add Autotools build system (automake, autconf)
This adds the familiar autotools build system and associated documentation
for Linux, FreeBSD, Mac, MinGW, and Cygwin.  The old Makefiles have been
kept, and where appropriate have been renamed Makefile-manual.

Thanks to Peter Stuge, Ludovic Rousseau, Xiaofan Chen, Alex Dupre, and
Segher Boessenkool for providing testing, review, and suggestions, and to
Ludovic Rousseau for providing patches which contributed to this commit.
2012-07-16 00:43:04 -04:00
Alan Ott 567304bf2d Add a .gitattributes giving autoconf files LF line endings 2012-07-16 00:43:04 -04:00
Alan Ott 4fec187ca2 Add .pc files for pkg-config 2012-07-16 00:43:04 -04:00
Alan Ott 38a7bf75f0 Renamed manual makefiles so they're out of the way of autotools
Files named Makefile which will conflict with autotools have been renamed to
Makefile-manual.
2012-07-16 00:43:04 -04:00
Alan Ott d370700973 Exclude ax_pthread.m4 from .gitignore 2012-07-16 00:43:04 -04:00
Alan Ott 9fb2477f68 Add ax_pthread.m4 in preparation for autotools build system
from http://www.gnu.org/software/autoconf-archive/ax_pthread.html
2012-07-16 00:43:04 -04:00
Alan Ott f33cba0492 Exclude pkg.m4 from .gitignore 2012-07-16 00:43:04 -04:00
Alan Ott d60d5f278b Add pkg.m4 in preparation for autotools
from https://gnunet.org/svn/Extractor/m4/pkg.m4
2012-07-16 00:43:04 -04:00
Alan Ott b417e9413e Remove MacOS TestGUI Binaries from git 2012-07-16 00:43:04 -04:00
Alan Ott 0a199c36ed Linux: Fix error in Makefile
When the libusb implementation was moved into libusb/, this Makefile didn't
get updated properly.
2012-06-05 16:18:49 -04:00
Sean M. Pappalardo 308ab89a26 Libusb: Prevent bailing out of read_thread() on non-critical errors 2012-05-18 13:12:28 -04:00
Chris Serio c8e917f018 Windows: Fixed an incorrect return type on HidP_GetCaps()
Addresses an issue with the return type of HidP_GetCaps() which was
returning the wrong status code because of the invalid return type of
BOOLEAN which is a UCHAR. The return code is supposed to be 0x110000
which obviously doesn't fit in a UCHAR so it was being rounded to
0x0. Basically, no return codes were ever making it through that call.
2012-05-17 08:53:30 +08:00