1
0
forked from drath/libratbag
Commit Graph

389 Commits

Author SHA1 Message Date
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
bentiss
e67fc075b2 Merge pull request #6 from phomes/master
minor cleanups
2015-09-12 09:28:15 -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
Thomas Hindoe Paaboel Andersen
86960308e7 tools: add a missing prototype 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
bentiss
244e6cf570 Merge pull request #5 from phomes/master
Add G5 to the hidpp10 driver
2015-09-11 17:34:49 -04:00
Thomas Hindoe Paaboel Andersen
56effdfba9 Add G5 to the hidpp10 driver 2015-09-11 22:48:39 +02:00
Benjamin Tissoires
0429609634 tools: fix macro time conversion to str
Those breaks... I keep forgetting them

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-10 18:03:37 -04:00
Benjamin Tissoires
ad18c0fd55 TODO: add discussion regarding keys/macros
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-10 16:10:03 -04:00
Peter Hutterer
a4515a59ae tools: strncmp -> strneq
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-11 03:57:59 +10: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
Peter Hutterer
b5e8247f55 Add a couple of TODO items 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
d7ef078c02 tools: Now, we have foo and bar as macro
Still not a parsing of the user input...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-10 08:49:51 -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
1e40cda292 data: minor adjustments to the SVGs
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
286f398763 tools: add a (currently fake) way of addressing a macro change
We need to implement a parsing of the given macro...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -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
e4f2f295c0 TODO: add macro todo list
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
Peter Hutterer
4333a8d9c3 Merge pull request #4 from phomes/master
minor fixes
2015-09-08 04:53:28 +10: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
Peter Hutterer
9c53dcc717 test: reduce the ref/unref test runs to 256
Nothing special about 1000, 256 checks the 2-byte boundary and beyond that
we're just testing whether the computer can count. Let's assume it can.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:44:25 +10:00
Peter Hutterer
fb709c876a test: add more refcounting test cases
And change some to drop all parent refs before we even test the struct we want
to test. This way we're more likely to blow up during the test too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 10:44:25 +10:00
Benjamin Tissoires
4f57efb98f test: add a test where we unref everything but the button
Similar to device_freed_before_profile but one layer after.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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