Commit Graph

1438 Commits

Author SHA1 Message Date
Peter Hutterer
9af58224fa resolution: export capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:14:13 +10:00
Peter Hutterer
61abdb57a7 device: export all capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:12:00 +10:00
Peter Hutterer
e0cb0c70e1 README: fix typo, this is ratbagd, not libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 09:12:36 +10:00
Benjamin Tissoires
420a05cabf README: Add instructions to have libsystemd >= 227
Works on F23. There are few dependencies pulled by configure that I did
not put there.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 09:12:33 +10:00
Benjamin Tissoires
2f6e1ceb73 libratbag v0.2
Doing just a first release of libratbag with its current features and
problems. This will help other tools to properly link against anything
libratbag >= 0.2

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
v0.2
2016-02-17 15:26:12 +01:00
bentiss
0df95f5c96 Merge pull request #60 from whot/master
Install the data files in $(datadir)
2016-02-17 08:13:17 +01:00
Peter Hutterer
9c37f5c300 Install the data files in $(datadir)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-17 16:46:46 +10:00
Peter Hutterer
262dd532e6 Add a log_verbose logging function for debug output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-17 10:33:20 +10:00
Peter Hutterer
80ed6d1399 resolution: switch to an index for ActiveResolution/DefaultResolution
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 17:00:27 +10:00
Peter Hutterer
c04f1b57aa device: switch active profile over to return an index only
Returning the object path makes it harder for the client to identify which
object is the active one. A simple index into the devices array is easier to
handle.

Note: another approach was to have an IsActive property on the profile
directly. This would require updating all properties when the active profile
is changed, it's simpler to just have one index.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 17:00:27 +10:00
Peter Hutterer
7aca92f2b3 resolution: add support for setting resolutions and report rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 09:56:12 +10:00
Peter Hutterer
e199278d6f profile: switch DefaultResolution/ActiveResolution over to an object path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:36 +10:00
Peter Hutterer
f2a55bca55 profile: add GetResolutionByIndex
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:35 +10:00
Peter Hutterer
bcd62aec6b resolutions: switch to using objects for resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:23 +10:00
Peter Hutterer
c4e4330bd1 profile: prefix the profile object path with a 'p'
sd_bus_encode_many() escaps elements starting with a digit so our 0 profile
has an object path of /.../_30. This is quite confusing during debugging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:12 +10:00
Peter Hutterer
c70b53a162 profile: add support for setting the active profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
3262def07c device: add support for get-svg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
d049c13062 device: drop default profile fetching, removed from libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:01 +10:00
Benjamin Tissoires
c657178d22 hidpp10drv: fix capabilities for gaming mice
Missing from 960ee73da9.

In case a hid++ 1.0 device has only 1 profile enabled under LGS, libratbag
exports only 1 profile, and thus the profile and button keys capabilities
are missing.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-11 11:16:30 +01:00
Peter Hutterer
2e1321cf93 Remove ratbag_profile_is_default from header file too
Missing from ff2d9713f7

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-11 17:18:46 +10:00
Peter Hutterer
5ffed21e0e Remove cleanup func define for sd_bus_message_unref
Added to systemd in 4afd3348c7506dd1d36305b7bcb9feb8952b9d6b
2016-02-11 17:16:58 +10:00
Peter Hutterer
e1c3449d03 Merge branch 'WIP/remove_default_profile' of https://github.com/bentiss/libratbag 2016-02-11 11:01:22 +10:00
Peter Hutterer
04e6f765d1 Merge pull request #59 from bentiss/WIP/remove_has_capability
Remove has_capability driver stub
2016-02-11 10:51:09 +10:00
Benjamin Tissoires
ff2d9713f7 Remove the default profile capability
We do not have any driver using it, and we are not sure this will even
be required. Before releasing a version with this, remove it. We
can always re-add this later if the need appears.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 15:22:25 +01:00
Benjamin Tissoires
960ee73da9 remove .has_capability() driver hook
Most of the capabilities can be inferred from
ratbag_device_init_profiles():
- if a device has more than one profile, we should be able to switch
  between its profiles
- likewise, more than one profile means that the buttons can be remapped
- more than one resolution means that we can change the resolution.

We need to add a stub in driver-test for .set_active_profile() now that
RATBAG_DEVICE_CAP_SWITCHABLE_PROFILES is correctly set.

We manually add the macro capability for all drivers that present it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 15:08:35 +01:00
Benjamin Tissoires
80fd187c3c Dynamically allocate the resolutions
We were limited to MAX_RESOLUTIONS (10). Also, this allows to know
during ratbag_device_init_profiles() if the device supports
switchable resolutions.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 14:39:38 +01:00
Benjamin Tissoires
df088466ae hidpp20drv: rework the initialisation process
Do not interleave some internal ratbag initialisation with the hidpp20
initial reading.
During early init, we are just interested in knowing how many
profiles/resolutions/buttons the device supports, so we should not read
more than required.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 14:34:14 +01:00
Benjamin Tissoires
3c3277a403 hidpp20drv: rework hidpp20drv_read_profile()
The current code might call some other function when the device supports
onboard profiles. We should not query those extra functions given that
the profiles should give us all we need.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 14:34:11 +01:00
Benjamin Tissoires
2f1c28598c hidpp20drv: extract hidpp20drv_read_resolution_dpi_2201()
Dissociate the reading of the data from the device of the actual storing
of those data in the profiles. This will allow to call
hidpp20drv_read_resolution_dpi_2201() without having profiles to know how
many sensors are in the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-10 14:34:03 +01:00
Benjamin Tissoires
0fccfc2338 test: check for the active resolution in the device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2016-02-09 15:15:46 +01:00
Benjamin Tissoires
638c6fb560 remove dead code in ratbag_profile_is_active()
The driver hook .get_active_profile() has been removed for a while now,
so remove this ugly #if 0.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-09 14:42:55 +01:00
Benjamin Tissoires
0c826ef251 fix copy/paste error in ratbag_profile_set_default()
It does not make sense to check for .set_active_profile() and then
use .set_default_profile().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-09 14:42:52 +01:00
Benjamin Tissoires
400823f37e drv-hidpp20: enable the profile when switching to it
libratbag external API is currently not aware whether a given profile is
enabled or not. Before switching to a disabled profile, we need to enable
it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-09 14:42:49 +01:00
Benjamin Tissoires
54fa8b6fa4 drv-hidpp20: implement set_current_profile()
Only enabled for PROFILES_8100.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-09 14:42:45 +01:00
Benjamin Tissoires
f3679bc8e7 hidpp20: fix return value of hidpp20_onboard_profiles_write()
data is a uint8_t*, so its size could never be 256, the size of the
profile.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-09 14:42:40 +01:00
David Herrmann
92ffda48ee Merge pull request #2 from whot/master
Add missing attributes.m4
2016-01-16 20:34:42 +01:00
bentiss
2bfab83470 Merge pull request #57 from NoXPhasma/NoXPhasma-patch-1
Add G500 profile to G9x mice
2016-01-12 14:06:46 +01:00
NoXPhasma
65e104d588 Add G500 profile to G9x mice 2016-01-12 12:58:26 +01:00
bentiss
accece5ed0 Merge pull request #56 from phomes/G9-profile-parse
hidpp10: Parse G9 profile
2016-01-08 09:48:12 +01:00
Thomas Hindoe Paaboel Andersen
14ca639270 hidpp10: Parse G9 profile
This allows to read but not write profiles from the G9.

The dpi mode sturct is a little different as the mouse only supports
symetrical dpi for x/y. Given the current naming a suffix of _sym
was the best I could come up with.

The G9 profile has some additional unknown bytes compared to the
others. Unfortunately the content of them varies for the 4 first
profiles and the last. So adding a default value for the like with
the G700 is not possible. For this reason I dropped implementing
the write part for now.

Something else to address is that this mouse only has 10 buttons
compared to the usual 13 that we have in PROFILE_NUM_BUTTONS. For
now I just hardcoded it in the profile and hidpp10_get_profile.
2016-01-07 22:30:23 +01:00
Benjamin Tissoires
8ed646fd7f hidpp20: do not overwrite macros when writing a profile
Same commit for hidpp20:
Previously, we would put a random address in the macro value, meaning we
lose the content of the macros.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-18 13:27:15 +01:00
Benjamin Tissoires
f05aafc786 hidpp10: do not overwrite macros when writing a profile
Previously, we would put a random address in the macro value, meaning we
lose the content of the macros.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-18 13:19:37 +01:00
Benjamin Tissoires
06d0c03ea1 hidpp10: parse macros
Macros are somewhat properly parsed in hidpp10.
The driver, however, supports only key press/release and delays.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-17 13:19:19 +01:00
Benjamin Tissoires
a9a8e23d37 hidpp20: parse macros
I am pretty sure we could do a better job, but heh.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-17 11:39:34 +01:00
Benjamin Tissoires
ff7a59f46a bump max events the macros can handle
We should probably dynamically alloc those then.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-16 16:01:30 +01:00
Benjamin Tissoires
94062a0881 hidpp20: implement hidpp20_onboard_profiles_destroy to free memory
Macros will be dynamically allocated, so we need a way to free them
reliably.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-16 14:17:30 +01:00
Benjamin Tissoires
4673b62eb4 hidpp10: enable metadata parsing on G500(s) too
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-14 17:28:21 +01:00
Benjamin Tissoires
8f18357e47 hidpp10: properly parse metadata in profiles
unknown3 in G700 is the constant string "LGS02". This string is a marker
for LGS to specify that the rest of the data is the names of the profiles
and macros.

SetPoint doesn't set those, so they are considered as metadata.

In libratbag, we will parse those properly and always set them, no matter
if the user used SetPoint or not.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-14 17:26:07 +01:00
Benjamin Tissoires
b3834f48c8 hidpp10: do not reject profiles with invalid CRC
The mouse accept them, so they are not invalid.

Only the profile directory seems to be checking for the CRC.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-14 16:52:55 +01:00
Benjamin Tissoires
59cd7b1091 hidpp10drv: do not look for profile specifics when the device doesn't support them
This prevents the M705 to shout that we need to set RATBAG_HIDPP10_DPI
and also allows the mice with only 1 profile to be configured.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-12-14 11:52:22 +01:00