hid_write() expects a report ID in the first byte. The 0x11 and 0x12
values sent as the first byte of commands are consistent with report
IDs published in the keyboard's USB descriptors.
This change was motivated by commands not working reliably using
hidapi on macOS with a G Pro keyboard.
NOTE: Ripple effect (0x05) seems to have a conflict with an unadvertised
"stars"-like effect for the G410 and G810. Did not explore setting
timing for the G410/G810 effect, but is likely contrasted greatly with
the timing of the new Ripple effect. GHub limits ripple timing between
20ms and 200ms, but actual values are arbitrary and were tested up to
5000ms. Ideally should be kept within the 20-200ms range for best feel
of the effect. Logo does not honor the effect, and GHub simply sets to
the default "Logitech Blue".
Signed-off-by: Kevin Pearson <kevin.pearson@ortmanconsulting.com>
TODO: There is a new ripple effect that needs to be added. This commit
only provides support for the current effects.
Signed-off-by: Kevin Pearson <kevin.pearson@ortmanconsulting.com>
I've tested the FX support on a g512 and all command work just fine with
the exception of not being able to set a logo color simply because there
is no backlit logo…
This patch just updates the help notice which mentions that the FX
commands are only tested on the g810, suggesting that they might not
work on other keyboards.
Raw use of 0xFF as the effectpart byte is device-undefined and was
implemented as a wrapper around mutliplle native effects calls as well
as handling the indicators. Logic was previously implemented in the
application, allowing for library use in this particular case to have
undefined behavior.
Signed-off-by: Kevin Pearson <pearson.kevin.m@gmail.com>
Help output does not need to initialize a device, so rearrange
the parsing to check for help commands prior to performing
any device IO.
Signed-off-by: Kevin Pearson <pearson.kevin.m@gmail.com>
Change argument parsing to segregate options from the command
Add -dv -dp and -ds options to allow matching a vendor ID, device ID,
and/or device serial number.
Modify --list-keyboards to parse the DeviceInfo vector and output
information to stdout.
Signed-off-by: Kevin Pearson <pearson.kevin.m@gmail.com>
Allow filtration and matching of specified Device ID, Product ID, Serial
Number
Fix an issue in listKeyboards (hidapi) with an out of bounds search when
using serial number
Fix possible null reference problem in listKeyboards (hidapi) that
caused rare segfaults when traversing the device enumeration in
increments of two
Fix handling of output of listKeyboards (hidapi) where it was
incrementing the dev list pointer, then accessing the node to look for
device serial number (potential security risk)
Fix handling of serial number output of listKeyboards (hidapi) to handle
wchar_t instead of outputting the memory address
Fix issue in listKeyboards (libusb) failure to finish cleaning up USB
contexts, leading to a segfault if calling a separate function after
listing keyboards.
Fix issue in close (libusb) segfaulting if m_hidHandle was null, so
added a check.
Modify listKeyboards to provide a vector of DeviceInfo objects that can
be used by calling applications instead of outputting to stdout directly.
Implement a struct to hold information regarding device information and
ability for a library caller to query this information to make decisions
about the currently targeted device.
Signed-off-by: Kevin Pearson <pearson.kevin.m@gmail.com>
Specified version string in makefile will now propogate to VERSION as a
macro appended to CFLAGS.
Cleaned up version string, quotes not necessary when specifying
major/minor/micro, though this is purely cosmetic.
Signed-off-by: Kevin Pearson <pearosn.kevin.m@gmail.com>
Currently supported:
- G213 by region {1..5}
- Standard FX calls
- Startup behavior
- Help and command-line app support
resolvesMatMoul/g810-led#69
Signed-off-by: Kevin Pearson <pearson.kevin.m@gmail.com>