1
0
forked from drath/libratbag
Commit Graph

1282 Commits

Author SHA1 Message Date
Benjamin Tissoires
84edfc23fc roccat: add support for changing the DPI
Again, this differs from the etekcity by not having to set the config
report first.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-13 18:40:40 -04:00
Benjamin Tissoires
86a40ba519 roccat: add support to write profile and macros
There is a slight difference with etekcity:
- there is no need to first set the config macro element we are about to
  send (the information are already in the macro report)
- we need to be sure the mouse processed the macro and is ready to handle
  a new command. Thus the introduction of roccat_is_ready()

We should see if the etekcity does not require such check too (IIRC it did,
but the timeout were sufficient).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-13 18:40:40 -04:00
Peter Hutterer
585a59796b Merge pull request #9 from phomes/no-refcount
hidpp10: drop internal ref counts
2015-09-14 08:33:53 +10:00
Thomas Hindoe Paaboel Andersen
bb5a7cbd1f hidpp10: drop internal ref counts
This caused a problem since the hidpp10_device would keep a ref to
the ratbag_device - and the hidpp10_device would only get destroyed
when the ratbag_device got a ref count 0.
2015-09-13 23:14:29 +02:00
Thomas Hindoe Paaboel Andersen
0a8642a6b0 hidpp10: make the fallback profile active and default 2015-09-13 23:01:26 +02:00
Thomas Hindoe Paaboel Andersen
fc13c15fe2 hidraw: only show the report IDs once 2015-09-13 18:18:16 +02:00
Benjamin Tissoires
55fc8dc721 roccat/etekcity: check for the presence of the key mapping report ID
Removes the duplicate nodes found by the drivers.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 23:31:45 -04:00
Benjamin Tissoires
90fa2251fa drv-hidpp**: check if the device accepts the HID++ reports
Removes the broken pipe on invalid nodes

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 10:17:34 -04:00
Benjamin Tissoires
84cfedbf5f hidraw: actually store the list of available report IDs
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 10:16:47 -04:00
Benjamin Tissoires
d065bda3a6 hidraw: implement a first dummy parsing of the report descriptor
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-12 09:48:01 -04:00
Benjamin Tissoires
24cb59af2f roccat: remove unused variable
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 09:46:54 -04:00
Benjamin Tissoires
b0e5508da9 Embbed the hidraw private elements in its own struct
mechanical patch

the hidraw_fd should only be used in libratbag_hidraw, so better having
it in its own struct so we can extend the hidraw elements without touching
ratbag_device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

# Conflicts:
#	src/libratbag-hidraw.c
2015-09-12 09:46:08 -04:00
Benjamin Tissoires
1ca65ce7cb libratbag.c should not close directly the hidraw node
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 09:41:44 -04:00
Thomas Hindoe Paaboel Andersen
7fbadce2fe remove unused function 2015-09-12 08:48:25 +02:00
Thomas Hindoe Paaboel Andersen
6a4d747132 remove a variable only used for sizeof 2015-09-12 08:48:25 +02:00
Benjamin Tissoires
f99a675476 roccat: check the crc on the profile
for the key mapping

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:46:18 -04:00
Benjamin Tissoires
ce0c3c9d20 roccat: break out the crc check
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:46:18 -04:00
Benjamin Tissoires
7f3c974212 roccat: compute the CRC on the macro report
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:46:18 -04:00
Benjamin Tissoires
96dbf49c60 roccat: read also the waiting time
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:46:18 -04:00
Benjamin Tissoires
2bc5b1910a Add roccat implementation
This driver is basically a duplicate of the Etekcity.
After the copy-paste, I renamed all the the "etekcity"
by "roccat" and then rev-engineered the various constants.

Still a WIP, but it is getting usable.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:44:58 -04:00
Benjamin Tissoires
1cbbcae37c Add the G303 as a known device
The G303 is a wired device and we need to talk to it with 0xff (OK a
#define would be good). This was not a problem for all of the unifying
devices given that the kernel overwrites the device_id for us, but the
corded devices are a different kind, and this one rejects device id != ff.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-11 17:43:35 -04:00
Thomas Hindoe Paaboel Andersen
56effdfba9 Add G5 to the hidpp10 driver 2015-09-11 22:48:39 +02:00
Peter Hutterer
69bb5d2f48 Add a default profile capability
Not all devices allow setting a default profile, make it a capability

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-11 03:42:44 +10:00
Peter Hutterer
43386ae31d driver-hidpp20: enumerate all capability values
Don't use a default here, let the compiler tell us when we're not handling a
value expclicitly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-11 03:42:44 +10:00
Benjamin Tissoires
80041666f2 Merge branch 'wip/macro' 2015-09-10 13:25:42 -04:00
Benjamin Tissoires
c2e72f4154 etekcity: remove magic constant
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-10 09:08:17 -04:00
Benjamin Tissoires
f44f07c6a9 etekcity: fix the check for macro
The current code was checking if the previous action assigned to a button
was a macro, not that the action we are assigning will be a macro.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-10 09:06:38 -04:00
Benjamin Tissoires
c2272c4f76 drv-hidpp20: change log priority
Kind of annoying when using the command "list".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-10 08:46:45 -04:00
Benjamin Tissoires
6910eabacc Add an additional macro API to commit the macro
Not very glorious

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
cdf710d807 add support for getting/setting the macro name
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
c7b7996f09 etekcity: actually write the macro to the device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
ce10bb1e84 macro: add first implementation
The doctext needs fixes and the API might not be final.
This however works and allow to read the macro.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
a7a1f1a2a4 etekcity: retrieve the macros while reading the button
Avoids one for loop and will allow to store the macro in the button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-08 11:34:56 -04:00
Benjamin Tissoires
7a679c9f97 hidraw: return -ETIMEDOUT when a timeout occured
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 16:12:00 -04:00
Benjamin Tissoires
a8e592e1bc hidraw: add ratbag_close_hidraw
Better to clean up the hidraw node too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 16:12:00 -04:00
Thomas Hindoe Paaboel Andersen
f018a67252 use info if given an invalid priority
Actually do what the log message says
2015-09-07 20:00:13 +02:00
Thomas Hindoe Paaboel Andersen
ea87c8b200 Remove unused include 2015-09-07 19:56:58 +02:00
Benjamin Tissoires
54aea717a5 fix typo in ratbag_button_action_match
We want the action to be matched, not be different.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 10:13:10 -04:00
Benjamin Tissoires
4017df40f3 etekcity: fix profiles raw mapping
Looks like they were offset by one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 10:13:05 -04:00
Benjamin Tissoires
f8cb6e0f39 etekcity-drv: fix compiler warning
we should not access resolution before it gets initialized...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 08:44:05 -04:00
Peter Hutterer
cb50b53467 Don't allow for more than INT_MAX refs on each struct
"2^31 are enough for anyone"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:44:25 +10:00
Benjamin Tissoires
5aa1c0b65d test: Add a test to use profile after unref-ing the device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-07 10:44:18 +10:00
Peter Hutterer
dc24ae3aaa Fix the ref/unref dependency
The current code has the profile ref the device, but the device has no back-ref to
the profile. The following code will free the profile from underneath the
client, despite the caller still having a valid ref:

p = ratbag_device_get_profile_by_index(device, 0);
ratbag_profile_ref(p);
ratbag_device_unref(device);

Fix this by not using refs internally. After probe, the device is static
anyway, so the various refs internally aren't needed. Instead, we also ref/unref
the parent struct whenever we ref/unref a struct. Thus, whenevever the device
refcount reaches zero, we know the caller has no ref active.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:16:19 +10:00
Peter Hutterer
409fd9abca Add ratbag_profile_destroy() and ratbag_button_destroy() helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:07:33 +10:00
Peter Hutterer
9f6a12fc48 Add a comment noting the initial refcount of the device and the context
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:07:33 +10:00
Benjamin Tissoires
7b2a43f17c testdrv: make sure .remove() is called only once
And be sure to not call it twice if the sanity check fails.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-04 11:59:04 -04:00
Benjamin Tissoires
97bfc86165 prevent a segfault in sanity_check_device
If a device has missing profiles, profile will be null and we will
have a segfault.
Better say that the device failed the sanity check.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-04 11:50:49 -04:00
Peter Hutterer
28a94d0974 Add a test suite
Two components are added here: a test driver that takes a struct
ratbag_test_device and sets that device up as a ratbag device.
That device is returned to the tests and then checked for sanity.

The ratbag_device_new_test_device() requires the environment variable
RATBAG_TEST set, otherwise we abort. It's also 'hidden' in a separate source
file, so it won't show up in doxygen. And if the test are disabled, this
function does nothing and the test driver never gets registered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 16:28:43 -04:00
Peter Hutterer
967fd3fd33 Make ratbag_find_driver/ratbag_device_new non-static
For future use in the test suite

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 16:28:43 -04:00
Peter Hutterer
04fa488a22 Allow a NULL udev device for ratbag_device_new
The client-exposed API requires a valid device, but internally we can handle
NULL - this way we can hook up the test suite easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 16:28:43 -04:00