Commit Graph

343 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen
6155d86923 hidpp10/20: retry on usb timeout
On the M705 I frequently get usb timeouts here if the device has
not been active for a while. Retrying after 10 ms seems to reliably
fix the timeout problem.

We could have just added the 10 ms sleep directly but it does not
seem to be neccesary on wired devices so I chose not to. Setting the
ret value to a face positive number and looping would also work but
we risk an endless loop. In the end I just went for a single retry
as that fixed the problem for me.
2015-09-15 20:24:56 +02:00
Benjamin Tissoires
e514da8218 drv interface: make the commit to the device mandatory
When writing a button, the given button should also be stored in the
memory of the device.
Amend the documentation

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 11:06:30 -04:00
Benjamin Tissoires
c7f8e851c1 etekcity: write the profile to commit the button asap
we should not require to actually write the profile to actually write the
button in the memory of the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 11:06:30 -04:00
Peter Hutterer
a3aacd3a99 Drop the _by_index suffix
This is the default, if we need a _by_name or so later we can add it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-16 00:55:12 +10:00
Benjamin Tissoires
41cf0176f0 roccat: remove spurious errors when waiting for the device to be ready
Not perfect but we need to figure out what 0x02 means eventually.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 10:46:26 -04:00
Benjamin Tissoires
3dc8f466ec roccat: abort if the macro does not match
If there is any problem while retrieving a macro, the first element in
the report might not match. In such cases, abort.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 10:38:12 -04:00
Benjamin Tissoires
892497ca60 roccat: retrieve the macro if we are not in the default profile
When the macro is not on profile 0, we need to set the mouse in the
correct mode first.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 10:37:17 -04:00
Benjamin Tissoires
ee0c58ca35 roccat: break infinite loops
When waiting for a status, the mouse sometimes answers 0x02, which seems
to be EINVAL (though it can be an ACK too). Treat this answer so we do
not end up in some infinite loops.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 10:36:10 -04:00
Benjamin Tissoires
8a99ed6436 roccat: write the profile to commit the button asap
we should not require to actually write the profile to actually write the
button in the memory of the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-15 10:34:42 -04:00
Benjamin Tissoires
8e1d750ba1 roccat: add SVG for the Kone XTD
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-13 18:40:40 -04:00
Benjamin Tissoires
e73e1e2ab1 roccat: replace various msleep with actual device wait for readiness
The device can tell whether it is ready or not, so better poll for it
instead of waiting 100ms and hoping for the best.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-13 18:40:40 -04:00
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