1
0
forked from drath/libratbag
Commit Graph

626 Commits

Author SHA1 Message Date
Peter Hutterer
ff44609bef hidpp10: use the directory profile count to get the device info
The G700 has 5 available profiles, bump HIDPP10_NUM_PROFILES.

On the other hand, hidpp10_get_device_info() doesn't fill anything...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-11-26 17:43:34 +01:00
Benjamin Tissoires
8d65710846 hidpp10: implement profile directory
The command get_profile can either return an index in the directory (in
the page 0x01 of the memory) or an absolute address. If the address is
returned, it is unclear whether the directory is updated.

This commit also includes changes from Peter:
hidpp10: if the profile index exceeds the number of directory index, use 0
hidpp10: factor out directory fetching
hidpp10: use the profile directory only in hidpp10_get_profile

Fixes #26

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-26 17:42:26 +01:00
bentiss
50e3ea61f4 Merge pull request #47 from bentiss/wip/hidpp10-udev-resolutions
hidpp10 udev resolutions
2015-11-25 14:21:18 +01:00
Benjamin Tissoires
e70760012e Todo: add profile disabled support
Etekcity, Roccat, Logitech support enabling/disabling of profiles, we
should too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-25 14:18:02 +01:00
Benjamin Tissoires
3e8bf85c04 hidpp10: build a table of available dpi settings
Each hidpp10 device should have a udev property named either
RATBAG_HIDPP10_DPI or RATBAG_HIDPP10_DPI_LIST. These properties ensure
that we know the mapping between the raw value of the dpi reported by the
mouse and the actual value.

Older devices (using the scheme 1 or 2 of hidpp10_get_current_resolution)
have to use the DPI_LIST to be able to map 0x80+.
Newer devices (using scheme 3) use the DPI setting with min, max, step.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-25 11:21:51 +01:00
Benjamin Tissoires
ef96a8649e private: exports ratbag_device_get_udev_property
Add a convenient function to retrieve a udev property.
Returns NULL if the property is not found.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-25 11:19:14 +01:00
Peter Hutterer
d83f8a30e0 Merge pull request #52 from jengelh/master
build: kill -no-install for installed binaries
2015-11-13 06:10:53 +10:00
Jan Engelhardt
c52dbc64f7 build: kill -no-install for installed binaries
With -no-install present in ratbag_command_LDFLAGS, the program would
get directly copied from .libs/ratbag-command to /usr/bin, retaining
the undesired rpath tag in the ELF file.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2015-11-12 19:20:51 +01:00
Benjamin Tissoires
0068ef2b06 hidpp20: use a struct definition for onboard profiles
Removes the magic constants here and there, though the description
of the struct is not very nice and clean.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:57:26 +01:00
Benjamin Tissoires
2a2d9e0f67 hidpp20: add a generic write_page function
Looks like the crc needs to be passed anyway, so have a common helper to
set the crc and write the whole page.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:57:25 +01:00
Benjamin Tissoires
9714ba53f5 hidpp20: update the dictionary when writing the profiles
If the device has never been configured under Windows, the dictionary
of the profiles might be blank. When it is blank, any changes made to
the profiles are ignored by the mouse.
Update a new dictionary if the profile was previously not enabled.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:57:18 +01:00
Benjamin Tissoires
8782c5117f hidpp20: the profile also contains a name
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:50:51 +01:00
Benjamin Tissoires
72d74da27c hidpp20: read the profile in ROM if the profile in flash is not valid
This happens after unboxing the mouse or if there is a wrong crc in
the profiles.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:50:48 +01:00
Benjamin Tissoires
ee2bd0475f hidpp20: move the crc function up
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:48:50 +01:00
Benjamin Tissoires
071a507d44 hidpp20: replace manual BE feeding by the helpers
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:48:50 +01:00
Benjamin Tissoires
f9db1f4bb6 hidpp-generic: implement various BE/LE functions
Not used here, but better having them written once.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:48:50 +01:00
Benjamin Tissoires
c478b7a7d2 hidpp10: use generic BE/LE access
No functional changes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:48:50 +01:00
Benjamin Tissoires
5c97492f44 hidpp20: fix LE/BE declarations, and move them to hidpp-generic.h
hidpp20_get_unaligned_be_u16 was LE, not BE.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-11-06 18:48:48 +01:00
bentiss
3fe3bc2fd7 Merge pull request #50 from Tele42/patch-1
Add G7 hwdb entry
2015-10-25 17:49:34 -04:00
Tele42
5afd36c245 Add G7 hwdb entry
This is untested, but should match a G5's behavior.
2015-10-25 17:35:57 -04:00
bentiss
e9be30cd26 Merge pull request #48 from paller/tools
Correct index check in ratbag-command
2015-10-25 08:01:58 -04:00
Palle Ravn
61dc211e04 Correct index check in ratbag-command
When initializing N profiles they are indexed 0 to N-1. However,
when setting the active profile to X the validation of X is a
check for X > N. Notice that N is invalid as the maximum index
is N-1.

Change the validation check of the new active profile to X >= N.

Signed-off-by: Palle Ravn <ravnzon@gmail.com>
2015-10-25 12:54:30 +01:00
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