Commit Graph

736 Commits

Author SHA1 Message Date
Peter Hutterer
4054616190 Revamp the button macro code
The previous API was inconsistent and different to the rest of libratbag's
API. Replace with one where a macro is a separate struct, can be initialized
and then written to the device with a set_macro() call. The device copies the
contents, the macro is otherwise unmodified and can be re-used by the client
if need be.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 14:22:22 +10:00
Peter Hutterer
578142964d Change ratbag_find_driver to ratbag_assign_driver()
We don't do anything with the return value anyway and we do assign the driver
in this function. Rename it and return a boolean only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 14:20:50 +10:00
Peter Hutterer
37bd43511b Switch to using an emum for error codes
Whenever we do something that may fail, return an enum of possible errors.

This also changes the API for ratbag_device_new_from_udev_device() to return
an error code now too instead of just NULL on failure.

Error numbers start at -1000 to avoid overlap with errnos, error_code() should
be used internally to avoid returning an errno.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 14:20:47 +10:00
Peter Hutterer
b53981c439 Add a few client error messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 11:54:46 +10:00
Peter Hutterer
bf8442a250 Use __cleanup__ to free the device name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 11:54:46 +10:00
Peter Hutterer
198523fe8f Simplify validity checks with assert
Let the caller check that what they're passing in is correct, we don't have to
respond with sensible error codes here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 11:54:46 +10:00
bentiss
7f7507a0dd Merge pull request #70 from whot/master
miscellaneous cleanups
2016-03-12 09:58:54 +01:00
bentiss
a08c8ebc60 Merge pull request #71 from cvuchener/fix-g500s-button-mapping
data: Fix G500s button labels and arrows

Fixes bug #69
2016-03-11 11:17:52 +01:00
Clément Vuchener
aa76cb5005 data: Fix G500s button labels and arrows
Changed button labels with their proper numbers and rotated arrows for wheel tilt buttons.
2016-03-11 11:07:01 +01:00
Peter Hutterer
be008cd86c Switch ratbag_get_num_resolutions() to return an unsigned
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:22:19 +10:00
Peter Hutterer
6f9aa5aa24 Coding style fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:22:19 +10:00
Peter Hutterer
bfe6d446ad Comment typo fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:22:15 +10:00
Peter Hutterer
855a6bd831 Fix error message on ENODEV
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:16:42 +10:00
Peter Hutterer
f5ff267c54 Improve a few error messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:16:39 +10:00
Peter Hutterer
014c4105f4 Remove superfluous check for a NULL udev device
If the udev device is NULL, we should fail a lot earlier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:16:37 +10:00
Peter Hutterer
52fea6f3ce Remove superfluous check for strdup() ENOMEM
If that happens, strdup_safe() will abort.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 16:16:35 +10:00
bentiss
43ab3c961e Merge pull request #68 from whot/wip/query-capability
Add a QUERY_CONFIGURATION capability
2016-03-10 14:31:39 +01:00
Peter Hutterer
f7523f000e Add a QUERY_CONFIGURATION capability
Designates a device that can be queried for the current configuration. Some
devices lack this ability so we rely on the caller to upload a known
configuration to the device before we can really proceed.

Set by default, devices without that capability should be the exception, not
the norm.

This patch just adds the capability, actual handling for this needs to be
added when we add the first device without this capability.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 16:53:55 +10:00
bentiss
765ee6c08c Merge pull request #67 from phomes/g9-read-dpi
hidpp10: Fix getting current resolution on G9
2016-03-04 09:02:55 +01:00
Thomas Hindoe Paaboel Andersen
577a7c52fc hidpp10: Fix getting current resolution on G9
On the G9 the response to a 0x63 is a short report. The G9 does
not have individual resolutions for X and Y and thus only needs
to report a single value.

The set version of 0x63 should probably also be updated. However,
while my testing of such a change worked better than with long
reports there are still strange side effects of setting resolution,
like turning off all the LED's. LGS also seems to do a full profile
read/write instead of using 0x63 when changing the resolution.
2016-03-04 00:19:10 +01:00
Benjamin Tissoires
85acab4642 hidpp20: fix correct number of resolutions in the profile
There are only 5 resolutions per profile.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-02 10:54:13 +01:00
Benjamin Tissoires
0b5ccfeaed hidpp20: re-enable G303
The G303 shares the same profile than the G402/G502. The only difference
is an extension at the end of the profile, but they are compatible.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-02 10:50:19 +01:00
Benjamin Tissoires
f108ffa9ff hidpp20: remove internal project name
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-02 10:49:07 +01:00
Peter Hutterer
f233b6bf77 data: add a README on how do do the data files
And update all devices to match the the requirements

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-02 09:09:17 +01:00
Peter Hutterer
c95d8e05ca lur: Add a note that we're not doing OOM
Mostly inherited from our zalloc() implementation. But really,
if you have no memory left, should you be trying to talk to receivers?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-02 09:08:58 +01:00
Peter Hutterer
b3237fd001 lur: change new_from_hidraw to return an errno
Makes debugging slightly more useful than just returning NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-02 09:08:13 +01:00
Benjamin Tissoires
7704c102e4 lur: add lur_device_get/set_userdata
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
BT: move the functions in LIBLUR_0.4.0
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-02 09:08:05 +01:00
Peter Hutterer
55cb7447f9 lur: capitalize use of Logitech Unifying Receiver
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-02 14:40:41 +10:00
bentiss
77eaa70f77 Merge pull request #63 from phomes/G9-set-profile
hidpp10: write profile for G9
2016-03-01 23:45:30 +01:00
Thomas Hindoe Paaboel Andersen
70d864af09 hidpp10: write profile for G9 2016-03-01 23:37:54 +01:00
bentiss
15968c8e39 Merge pull request #62 from phomes/g9-features
hidpp10: Add button mappings for G9
2016-03-01 23:12:00 +01:00
bentiss
0558bd4101 Merge pull request #61 from phomes/cleanup
Follow up for #56
2016-03-01 23:10:56 +01:00
Thomas Hindoe Paaboel Andersen
3962ec7745 hidpp10: Add button mappings for G9
There are 10 buttons defined in the profile but only 9 physical
buttons. LGS also only allows to configure 9 of them. Button 5
is the "dead" button in the list.
2016-03-01 22:11:47 +01:00
Thomas Hindoe Paaboel Andersen
2164a3b549 libratbag: remove unused variable 2016-03-01 21:20:23 +01:00
Thomas Hindoe Paaboel Andersen
f0417a9535 hidpp10: Add definition for buttons on the G9 2016-03-01 21:20:18 +01:00
Thomas Hindoe Paaboel Andersen
9d9c42cc6a hidpp10: rename structs wrt _sym vs. _dual
Follow up for review in #56
2016-03-01 21:20:13 +01:00
Benjamin Tissoires
efd15a33fb configure.ac: libratbag 0.3
Soname bump for liblur and libratbag as they were not properly versioned.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
v0.3
2016-03-01 17:04:39 +01:00
Benjamin Tissoires
b804e117c1 hidpp20drv: fix segfault when a device is not powered on
We were returning 0 and libratbag tried to access the profiles afterward.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 16:59:32 +01:00
Benjamin Tissoires
b54d28ec1a tools: add a man for ratbag-command
Just duplicated the help.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 16:46:31 +01:00
Benjamin Tissoires
388dae76bc libratbag.sym: bump symbols version
0.1.0 never existed, the first release was 0.2 :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 15:35:33 +01:00
Benjamin Tissoires
19f87790bb Add liblur versioning and pkg-config
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2016-03-01 15:34:46 +01:00
Benjamin Tissoires
9aa8938eb8 hidpp20: profiles: make sure the mouse is in the profiles mode, not HID
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 15:05:50 +01:00
Benjamin Tissoires
25094daaed hidpp20: profiles: make sure device is compatible with our implementation
Get_Profile_Info gives valuable information to know if we are compatible
with a given device. Use it and bail out if we are not able to support
the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 14:57:19 +01:00
Benjamin Tissoires
39069623f2 hidpp20drv: bail out if the features are not working as expected
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 14:36:03 +01:00
Benjamin Tissoires
d5c74682f1 Add missing carriage return when the driver does not match
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 14:32:42 +01:00
Benjamin Tissoires
6cba2abd8e hidpp20: reorder profile initialization
Spec says the profile count is stored in byte 3 of
CMD_ONBOARD_PROFILES_GET_PROFILES_DESCR, so use this to allocate the proper
number of profiles.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-01 14:15:15 +01:00
Peter Hutterer
f58b91a9b2 When setting a button action, update our internal state on success
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2016-02-29 09:58:18 +10:00
Peter Hutterer
de08323609 Fix return for ratbag_button_get_special when we don't have a special action
Do what the doc says.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-24 10:51:28 +10:00
Peter Hutterer
5fcdfab2a6 Fix a doxygen ref
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-24 10:51:07 +10:00
Benjamin Tissoires
e07839bcee tools: remove no-install flag for lur-command
The resulting RPM complains about RPATH.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-02-18 14:25:18 +01:00