Commit Graph

604 Commits

Author SHA1 Message Date
Peter Hutterer
99e1002701 Build libratbag-util as helper library
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 09:49:56 -04:00
Peter Hutterer
bdcc194e41 hidpp10: implement get_extended_pairing_info for the serial number
This request has more information, for now we just fetch the serial number

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-23 09:49:43 -04:00
Peter Hutterer
3eb331da50 hidpp10: fix truncated device name
The hidpp10 name length does not include the terminating zero.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 14:05:07 +10:00
Peter Hutterer
a5ee32eac8 hidpp10: add hidpp10_close_lock
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 14:04:59 +10:00
Peter Hutterer
e769108bf6 Namespace the receiver/wired device idx defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 13:45:33 +10:00
Peter Hutterer
74457d111d Use the hidpp.la helper library in libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 07:21:38 +10:00
Peter Hutterer
c024de52ea Merge hidpp10.la and hidpp20.la together into one single helper lib
No real reason to keep the two separate, and if we do and need to include both
libraries, we get double-defined symbols (all the ones in hidpp-generic.c).
This is a helper lib only anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-23 07:21:38 +10:00
Benjamin Tissoires
98a58a0e5e hidpp20drv: implement dpi change for onboard memory profile devices
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
c534d7a619 hidpp20drv: fill in the capabilities when parsing the features
Or we need to maintain the list of supported capabilities in a different
place, and it gets error prone.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
6a522f5354 hidpp20drv: rename the internal per feature read_button
Allows to navigate in the source more easily if they share a common
name.
However, this is still not good because we need to know which feature
number is which.

Though the format is now in sync with write_button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
3753bd3216 hidpp20drv: implement write_button for devices with profiles
Still missing the consumer control HID keys, but the rest works (minus
the modifier keys).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
6dfada8628 hidpp20drv: extract feature 1b04 from write_button
To support profiles assignments, we need to split the various write
button functions.
Start with 1b04.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
ba26f6f35c hidpp20: implement the write functionality of the profiles
Not completely full features, but works to set the DPI, report rate and
buttons assignments (no macros yet).

The current code reads first the current values, changes that needs to be
changed and writes back the data. Long term, we want to build the data
directly from the profiles and just write them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
2d020e840a hidpp20: fix the profile size
the profile contains 16 pages of 16 bytes, not only 15

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:14:03 -04:00
Benjamin Tissoires
32e18e5cad tools: shared: keep only one instance of the mapping action/str
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:13:58 -04:00
Benjamin Tissoires
f85a700c27 tools: shared: fix reporting of RATBAG_BUTTON_ACTION_SPECIAL_SECOND_MODE
Setting the special command and displaying it were using a different
spelling. Fix that.

We should really only have one entry point for that.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-22 15:13:29 -04:00
Peter Hutterer
844edbfeeb doc fix for ratbag_unref
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-22 10:37:15 +10:00
Benjamin Tissoires
88083511db hidpp20: remove unused parameter
profiles_list is not used anymore in hidpp20_onboard_profiles_get_current_profile
let's remove it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-21 16:01:13 -04:00
Peter Hutterer
07dbf22f38 Merge pull request #44 from bentiss/wip/rename_hidpp10_device_new_from_idx
hidpp10: rename hidpp10_device_new_from_idx into hidpp10_device_new
2015-10-21 12:53:40 +10:00
Peter Hutterer
ee87c389c0 tools: fix missing return value
hidpp20-dump-page.c: In function ‘dump_everything’:
hidpp20-dump-page.c:85:1: warning: control reaches end of non-void function
[-Wreturn-type]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-21 12:44:00 +10:00
Benjamin Tissoires
7da4bd7e1e hidpp10: rename hidpp10_device_new_from_idx into hidpp10_device_new
There is only one constructor left.
Get rid of the static hidpp10_device_new() that is not adding much.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 21:43:59 -04:00
Benjamin Tissoires
40fe1b0eac hidpp10: remove hidpp10_device_new_from_wpid
hidpp10_device_new_from_wpid() can not work anymore given that we are not
talking to the receiver anymore, but directly to the device.

The proof being that .wpid is never set in struct hidpp10_device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:56:58 -04:00
Benjamin Tissoires
06c742d172 tools: add a tool to dump the memory of hidpp20 devices
Mostly copy/paste from hidpp10-dump-page

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:38:19 -04:00
Benjamin Tissoires
21d22bf74e hidpp20: change hidpp20_onboard_profiles_read_memory API
It looks like we can not use a section > 0xff and that the first
parameter corresponds to the type of the available memory (rom or flash).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:32:56 -04:00
Benjamin Tissoires
d3abebf202 hidpp20: change hidpp20_onboard_profiles_read_memory API
It looks like we can not use a section > 0xff and that the first
parameter corresponds to the type of the available memory (rom or flash).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:31:46 -04:00
Benjamin Tissoires
3294c5c048 hidpp20: parse the special keys in the profiles
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:28:47 -04:00
Benjamin Tissoires
fa3419b3c0 hidpp20: parse the key mapping
Still lack the modifiers, but this should eventually be exported as a
macro...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:26:14 -04:00
Benjamin Tissoires
26fdafb881 hidpp20: parse the buttons mapping in the profiles
Only export the actual buttons in ratbag_button for now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:25:59 -04:00
Benjamin Tissoires
24f7319a6f hidpp20: read the button count from the mouse
When using onboard profiles, it looks like we have the button count.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:24:03 -04:00
Benjamin Tissoires
7c1718d316 hidpp20: first parsing of feature 0x8100 - onboard profiles
Obtained by rev-engineering the protocol.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 17:24:02 -04:00
Benjamin Tissoires
4991118bcd hidpp20: simplify internal hidpp20_feature_set_get API
We do not export it anymore and we plan to use it only in
hidpp20_device_new().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:59:48 -04:00
Benjamin Tissoires
dcf0a0e89d hidpp20: use the internal list of features instead of asking the device
We already know the indexes in the table, so there is no point in making
a round trip to the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:49:17 -04:00
Benjamin Tissoires
43ac20de69 fix "Failed to get HID++1.0 device " 2015-10-20 16:49:17 -04:00
Benjamin Tissoires
2ff7bff6df hidpp20: remove uninitialized variable use
get_mousepointer_info does not take any parameters.
Remove the warning.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:49:17 -04:00
Benjamin Tissoires
6ac92f8479 hidpp20: retrieve and store the list of features once for all
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:49:13 -04:00
Benjamin Tissoires
8ffa2f9b96 hidpp20: retrieve the protocol version in hidpp20.c
We need hidpp20 to handle the list of available features. So we need to be
sure in hidpp20 that we are talking to a hidpp20 device.

Move the version retrieval in hidpp20 where it makes sense.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:19:02 -04:00
Benjamin Tissoires
65888eedd4 hidpp20: add new struct hidpp20_device
This struct will be used to store the table features/index and probably
others. It also allows a single entry point to set the device index.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 16:18:56 -04:00
Benjamin Tissoires
39345f6e85 hidraw: add input/hid usage mapping for keyboard usages
Etekcity and Roccat are using raw HID code to send the macros. The Logitech
hid++ 2.0 are too so let's centralize the code in hidraw and simplify
the code per-driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 15:25:09 -04:00
Benjamin Tissoires
e89566c5c9 hidraw: add the HID usage table values for keyboard usages
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 15:25:05 -04:00
Benjamin Tissoires
a2a1f296e6 Add 2 special keys found on the Logitech G502
RATBAG_BUTTON_ACTION_SPECIAL_RESOLUTION_ALTERNATE (for the "sniper switch")
RATBAG_BUTTON_ACTION_SPECIAL_RESOLUTION_DEFAULT -> means what it means

And fix one missing entry in str_to_special_action.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 15:25:01 -04:00
Benjamin Tissoires
ae587826ca hidpp20drv: rename field 'base' into 'dev'
'base' was wrongly inherited from the hidpp10 implementation, but actually
it makes no sense in this context.
Also, we want to reserve the keyword 'base' for when we introduce
hidpp20_device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-20 15:24:43 -04:00
Peter Hutterer
0726537a21 hidpp10: use a #define for the max page number
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-19 09:56:21 +10:00
Peter Hutterer
65db99334b hidpp10: allow the caller to set the open_lock timeout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-19 09:56:13 +10:00
Peter Hutterer
983c830ff3 Merge pull request #42 from phomes/memory-offset2
Fix dumping memory pages
2015-10-19 08:07:59 +10:00
Peter Hutterer
ca395e849c Update TODO
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-19 07:15:08 +10:00
Thomas Hindoe Paaboel Andersen
123254c737 tools: Dump the full page
The pages are 512 bytes. Increase the limit to dump the full page.
2015-10-18 13:20:07 +02:00
Thomas Hindoe Paaboel Andersen
7e5f77f402 hidpp10: read_memory should take offset in bytes
The current API takes offset in 2-byte values. Taking a byte value
is more natural. We need to upgrade the type of offset to uint16_t
to handle values > 256.
2015-10-18 13:20:07 +02:00
Benjamin Tissoires
3b3b9ce0a2 hidpp20: switch hidpp20 to use the non-libratbag dependencies too
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-16 16:43:46 -04:00
bentiss
dda46c20c0 Merge pull request #38 from whot/wip/hidpp10-as-separate-library
hidpp10 as separate library
2015-10-16 16:43:13 -04:00
Peter Hutterer
0cb1fe44ad tools: ad a hidpp10-dump-page tool to dump a HID++1.0 device's memory
For protocol debugging, it's a lot easier to go have a simple helper than
having to go through the whole of libratbag.

And remove the page-dump helper from the main code.

Note that this tool needs a /dev/hidraw device directly, not an event node. It
is a debugging tool after all.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-16 08:22:11 +10:00