Commit Graph

768 Commits

Author SHA1 Message Date
Benjamin Tissoires
64037febdc hidpp20: fix return path for hidpp20_onboard_profiles_read
A negative error means a communication error, while a positive one means
a HID++ one. Make sure we abort early enough.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-05-09 19:51:46 +02:00
bentiss
fd10ebbc87 Merge pull request #83 from whot/ignore-keyboard-devices
Ignore devices that don't have ID_INPUT_MOUSE set
2016-05-09 10:37:11 +02:00
Peter Hutterer
91eefb9a3f Ignore devices that don't have ID_INPUT_MOUSE set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-05 12:57:11 +10:00
Benjamin Tissoires
1da0180e0f hidraw: do not return success if match failed
rc is set to 0 by ratbag_open_hidraw_node(), and if matched failed, we
close the hidraw node and end the loop.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-04-29 12:10:41 +02:00
bentiss
22abddc9d4 Merge pull request #82 from whot/wip/logitech-auto-detect
Wip/logitech auto detect
2016-04-29 12:04:59 +02:00
Peter Hutterer
e912f56c26 driver-hidpp20: don't log an error if we can't init a hidpp20 device
Once we start probing devices for multiple drivers we shouldn't just print
error messages for every failed driver. In the hidpp20 case an error would be
printed for any hidpp10 logitech device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 10:14:11 +10:00
Peter Hutterer
a715679f1f Add a fallback for Logitech's HID++ devices
If a device is not specifically assigned a driver, try hidpp20 and then
hidpp10 hoping that one of them will work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 10:02:42 +10:00
Peter Hutterer
55673442f1 Split the driver search + testing into a helper function
Prep work for being able to probe multiple drivers on a device. The function
that tests the actual driver simply takes a const char * with the driver name,
so in the future we can loop through multiple driver names easily.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 10:01:24 +10:00
Peter Hutterer
b6294d4f93 Add a new header for PID/VIDs that we need to care about
Beats having the same #define in multiple places

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:56:22 +10:00
Peter Hutterer
40112e6061 driver-hidpp20: re-use the destroy function for cleanup during init
No need for two separate cleanup blocks, they're doing the same thing anyway.
Just make the function more robust to uninitalized fields and we're good to
go.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:55:58 +10:00
Peter Hutterer
0785bf138d hidpp20: fail for hidpp10 devices
hidpp10 devices have their own driver, let's not initialize them here and just
fail. If a hidpp10 device is assigned the hidpp20 driver this is a bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:50:20 +10:00
Peter Hutterer
e18e25d685 hwdb: Add Logitech Wireless Touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-21 14:13:46 +10:00
Peter Hutterer
85fdea19c2 Link to the github-pages generated documentation
To update the documentation, do the following:

  	# delete current documentation
	pushd doc/html
	rm -rf $PWD/*
	# clone into current directory, checkout gh-pages
	git clone git@github.com:libratbag/libratbag .
	git checkout -b gh-pages
	# delete master branch so we don't accidentally push that one
	git branch -d master
	# return to main, generate docs
	popd
	make
	# commit updated docs, push
	pushd doc/html
	git commit -asm "Updated documentation"
	git push origin gh-pages
	popd

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-17 15:21:06 +10:00
bentiss
792b6c28df Merge pull request #79 from whot/master
Fix a couple of error messages
2016-03-16 10:17:06 +01:00
Peter Hutterer
5c68164d48 etekcity/roccat: fix error message when we can't talk to the mouse
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-16 10:00:09 +10:00
Peter Hutterer
b1d99a744b Standardize the error on device open failures
No reason for the drivers to have their own printf each, just return the
negative errno and let the common code print it.

This now also means that we only return -ENODEV on something that's not really
an error, for anything else we print the strerror.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-16 10:00:09 +10:00
Peter Hutterer
9f544cbe1c Revert "Fix error message on ENODEV"
We now get an error message for all devices that have duplicate event nodes
because we use -ENODEV for 'device not found', 'device is a duplicates' and
'device doesn't have the hidraw report'.

The original commit was triggered by a misunderstanding of the error message,
will be fixed in a follow-up.

This reverts commit 855a6bd831.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-16 10:00:09 +10:00
bentiss
ad06d29140 Merge pull request #77 from whot/master
configure.ac: udev basedir should be relative to prefix
2016-03-15 08:34:54 +01:00
Peter Hutterer
c12cb66824 configure.ac: udev basedir should be relative to prefix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 09:48:52 +10:00
Peter Hutterer
c476cd0654 Merge pull request #76 from r3pek/master
Fix supported resolutions from G700s
2016-03-15 07:38:56 +10:00
Carlos Silva
98315343b0 Fix supported resolutions from G700s
I was under the impression that G700 and G700s had the same sensor.
Comparing the specs on the Logitech website, i found myself wrong.
2016-03-14 20:56:00 +00:00
bentiss
eb6787181d Merge pull request #75 from r3pek/master
Add Logitech G700s
2016-03-14 20:48:26 +01:00
Carlos Silva
f7d9ca63e2 Add Logitech G700s 2016-03-14 19:14:16 +00:00
Benjamin Tissoires
b563467164 configure.ac: libratbag 0.4
Soname bump for liblur and libratbag as their ABI has been broken in
this release.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
v0.4
2016-03-14 19:55:43 +01:00
Benjamin Tissoires
86e9a7abcd lur: bump the version of the library
commit b3237fd0 ("lur: change new_from_hidraw to return an errno") broke
the API, so we need to bump the version too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 19:54:39 +01:00
Benjamin Tissoires
030eaa7c1c Add G502 svg data
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 17:19:52 +01:00
Benjamin Tissoires
ae129fe911 Add G700 svg data
Most of the SVG work was made by Peter. Cheers!

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 16:20:56 +01:00
Benjamin Tissoires
6190f0c7bf Make sure we do not put random values in the .macro field of buttons
Otherwise, as soon as we set an action for a button, we get a nice
invalid free on cleanup.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 16:20:56 +01:00
Benjamin Tissoires
717505daef Test: add a set_button test
Which currently fails.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 16:20:56 +01:00
Benjamin Tissoires
8ede0b734f Test: make sure the macros ref/unref are tested
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 16:20:53 +01:00
Benjamin Tissoires
090851fce1 Test: add some generic tests for the buttons
Currently only ref/unref

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-14 16:20:50 +01:00
bentiss
164232bbbc Merge pull request #74 from whot/wip/macro-rewrite
Rewrite the macro API, which contains PR #72 (Some more cleanup) and PR #73 (Use error enums)
2016-03-14 11:07:28 +01:00
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