Skip to content
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

Some Makefile changes #3

Closed
wants to merge 48 commits into from
Closed

Some Makefile changes #3

wants to merge 48 commits into from

Conversation

LudovicRousseau
Copy link
Contributor

No description provided.

Ludovic Rousseau and others added 30 commits November 19, 2010 08:46
Avoids a crash if libusb_get_active_config_descriptor() returns with an
error code.
kCFNumberSInt32Type is expecting a Thirty-two-bit, signed integer.
long is 64-bits on a 64-bits CPU so is the source of problems,
especially on a big endian CPU.
The problem is that the file descriptor 1 used by printf() may not be
stdout but somethink else. For example a daemon may close fds 0, 1 and 2
and reuse them to open files or sockets. So using printf() may send data
on a file or socket opened by the application.

Errors will now be logged to stderr only if DEBUG_PRINTF is defined.
Use the classic
 #ifndef __HIDAPI_H__
 #define __HIDAPI_H__
 ...
 #endif
Use HIDAPI_H__ instead of __HIDAPI_H__
Do not fail if the files to remove do not exist
*.o does not match ../hidtest/hidtest.o so we must use an explicit list
of .o file names
The user may have a custom CFLAGS with debug flags like -Wextra. These
flags should be used instead of overwritten
We first check that the HID device is managed by the kernel before
calling libusb_detach_kernel_driver(). This will avoid side effects of
libusb_detach_kernel_driver() like also doing a
libusb_release_interface()
Conflicts:
	linux/hid-libusb.c
Use kIOHIDOptionsTypeSeizeDevice instead of kIOHIDOptionsTypeNone to
avoid interferences with other applications trying to use the HID device
at the same time.
We should re-enumerate the HID devices each time hid_enumerate() is
called to detect devices removed or added.
The HID library cannot assume a CFRunLoop will be used by the
application. For example a command line tool may not use the CFRunLoop.
The re-enumeration also change the internal names of already enumerated
devices. A bad side effect.
The really missing function was hid_exit() to free ressources allocated
by the HIDAPI and libusb libraries.
LudovicRousseau and others added 18 commits August 21, 2011 10:07
This fixes the performance issue caused by calling CancelIo() when no data arrives in asynchronous (non-blocking) mode. Reported by Bill Good.

This new design also fixes the race condition causing lost packets that can happen if data comes between the time when the Event was checked (WaitForSingleObject()) and the CancelIo() call. Reported by Hans Van Leemputten.
Fixed Logic error from the last commit where the wrong data was checked.
hid_read_timeout() will execute a blocking read up until a timeout has been
reached or data has been received.

This patch implements it on all platforms and comes from Urs Fleisch.
Commit log message by Alan Ott.

Signed-off-by: Urs Fleisch <urs.fleisch@gmail.com>
Tested-by: Alan Ott <alan@signal11.us>
Add hid_read_timeout() to mac.
Added the HIDIOCSFEATURE and HIDIOCGFEATURE ioctl macros to hid.c so that it
will compile with older kernel headers. This of course doesn't make it _run_
with older kernels. Some distros ship older kernel headers than the running
kernel.
This is especially important for cross compilation.
Some cross compiling frame works like OpenEmbedded [1] pass this variable along.

[1] http://www.openembedded.org/
0. VDR`s `Makefile` was taken as a template [1].
1. Separate variables for flags for `CC` and `CXX` were introduced. `-c` is now passed explicitly. Further flags for `CXX` could be added like in VDR’s `Makefile`.
2. Separate variable `INCLUDES` defined which is only used for the libraries(?).

[1] http://git.gekrumbel.de/vdr.git?p=vdr.git;a=blob;f=Makefile;hb=bd61fee1e9328aec470c319494cccb90e53302c2
--
Please note that this is not build tested.
Zbigniew Czapiga noticed that some of the udev objects in linux/hid.c weren't
being freed properly.
Although the Windows API doesn't provide direct access to interface number,
on child devices representing the interfaces of a composite device, it is
parsable from the device path. An excerpt of a path for interface 1 of a
Razer Hydra device is as follows:
\?\hid#vid_1532&pid_0300&mi_01

See table 4 and related text here:
  http://msdn.microsoft.com/en-us/windows/hardware/gg487473

This patch, if a path is available, and further, if &mi_ is found, parses
what it can for a hex value into the interface_number field. If there is
any problem, the invalid value (-1) is used instead.

Patch from Ryan Pavlik <abiryan@ryand.net> with modifications by Alan Ott.
Multiple users have reported the need to pass
SHARE_MODE_READ|SHARE_MODE_WRITE to CreateFileA(). It seems that some
devices will not open at all if sharing is not requested. This commit
makes it so that CreateFileA() will be tried twice, the first time with
sharing mode OFF (passing 0x0 to the ShareMode parameter of CreateFileA()),
and if that fails, it will try to open the device with share mode ON
(passing the above SHARE_MODE_ flags to the ShareMode parameter of
CreateFileA()). This will have the following effects:

For normal devices:
   Devices will open as normal. Only one instance can be opened at a time.
For devices which require share mode to be on:
   Devices will now open (they would not open at all before). Multiple
   instances can be opened. This is less than desirable, but the
   alternative is that these devices don't open at all.
@signal11
Copy link
Owner

This pull request has become rather large (likely by accident), and I believe I applied the original Makefile changes long ago but didn't close this request. I'm closing it now. If I'm not correct, please open up another one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants