Ogier Bouvier
c56c76e07d
hidpp20: fix resolution count detection
...
fix #343
Signed-off-by: Ogier Bouvier <obouvier@logitech.com >
2017-09-14 16:02:40 +02:00
Ogier Bouvier
548a40dba6
hidpp20: store correct size for feature list
...
Signed-off-by: Ogier Bouvier <obouvier@logitech.com >
2017-09-13 10:17:37 +02:00
Benjamin Tissoires
c437882e96
tools: ratbag-command: info: make use of _cleanup_
...
Better code :)
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Ogier Bouvier
4a61dc413b
support sector size that are not multiple of 16
...
Signed-off-by: Ogier Bouvier <obouvier@logitech.com >
Squashed the comment into this
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
59df7defdb
tools: add hidpp20-reset
...
Basically a nuclear weapon to reset the flash to 0.
Use it with caution!
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
77fa6a1e65
hidpp20: fill in all profiles, even if they are not there
...
If a profile is either wrong or not there, we rely on the ROM to get
a correct profile.
Fixes #280
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
0f8031c201
hidpp20: add commit API for onboard profiles
...
The driver is supposed to prepare everything in memory and then, at the
end commit on the device.
Bug #280 is still not fixed as we should initialize empty profiles first.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
5842dccc2a
hidpp20: check if crcs are valid once on plug
...
To check if device is using ROM or Flash settings.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
0c5b1998a5
hidpp20: move down hidpp20_initialize
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
f52ebd0dba
hidpp20: move up hidpp20_internal_profile
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
1857378a76
hidpp20: new memory model
...
Only reading/writing full sectors are allowed (because we need to set and
read the crc anyway).
Fixes #122
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
d2600583bb
hidpp20: do not mixed hex and decimal
...
because this is bad
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
e2a4684f83
hidpp20: use min when possible
...
s/x <= y ? x : y/min(x, y)/
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
ed39cf3dee
hidpp20: reshuffle onboard_profile allocate/initialize
...
allocate was actually both initializing and allocating through initialize.
Things started to get complicated.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
c4d3b1e606
hidpp20: fix Invalid writes
...
Valgrind complains...
Fixes 19451f9df7
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-13 09:21:53 +02:00
Ogier Bouvier
19451f9df7
hidpp20: fix last feature discovery
...
Signed-off-by: Ogier Bouvier <obouvier@logitech.com >
2017-09-08 15:40:55 +02:00
Thomas Hindoe Paaboel Andersen
3314b41202
hidpp10: fix outdated info message
2017-09-08 08:56:03 +10:00
Thomas Hindoe Paaboel Andersen
f636fd8f53
G300: set active resolution
...
For the active profile we read the active resolution
from the mouse during probe.
When changing the active profile we set the default
resolution to active.
2017-09-07 10:30:37 +02:00
Peter Hutterer
692f7f008a
Fix typo
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-09-07 09:21:45 +10:00
Benjamin Tissoires
0a62c3dfa8
hidpp20: fix mem leak
...
Valgrind complains about it, so let's fix it.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-09-05 19:18:10 +10:00
Thomas Hindoe Paaboel Andersen
efe6021e76
G300: fix profile switching
...
The profile ID's used are:
profile 0: 0x80
profile 1: 0x90
profile 2: 0xA0
These were miscalculated as 0x80, 0x81, and 0x82.
2017-09-04 09:25:38 +10:00
Peter Hutterer
4037587f74
Get the libratbag data dir from the environment variable
...
And set it for the tests, so we can test with in-tree files.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-09-01 09:49:32 +02:00
Peter Hutterer
6f0242f05b
Add missing include for stdint.h to libratbag-test.h
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-09-01 10:53:37 +10:00
Peter Hutterer
bb23f68d53
util: avoid reallocation of zero-sized memory in dpi list parsing
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-31 09:48:52 +02:00
Peter Hutterer
83345a17d2
hidpp20: add an assert to shut up scan-build
...
Not sure why it thinks we're potentially dereferencing a NULL-pointer here but
from the trace it looks like it thinks macro and a previously nullified
profile->macros are the same. They aren't, macro was just allocated here and
shouldn't be NULL if we get here.
Anyway, add an assert and move on.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-31 09:48:52 +02:00
Peter Hutterer
7eadd20879
hidpp10: fix a coverity warning about OOB access
...
Make sure that the index we pass into long_clear_bit is never higher than the
number of bits in the single long we use as array here.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-31 09:48:52 +02:00
Peter Hutterer
3844a60837
hidp20: fix dead code in macro parsing
...
If rc is positive, it's the number of items.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-31 09:48:52 +02:00
Peter Hutterer
8cb2d21ff5
Remove unnecessary NULL check before free()
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-31 13:03:07 +10:00
Benjamin Tissoires
c647d6df99
profiles: add name get/set capability
...
Some devices can have a custom name, so let's export that capability.
In ratbagd, libratbag/ratbag_profile_set_name() returns an error, we
put it under silence, the client has to check for the capabilities
before asking ratbagd to change the profile name.
Fixes : #266
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-08-31 10:22:51 +10:00
Benjamin Tissoires
97a927bb7d
profiles: add a per profile capabilities field
...
Doesn't do much now without the next commit
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-08-31 10:22:51 +10:00
Thomas Hindoe Paaboel Andersen
3fd7cd0137
improve error for missing device files
2017-08-31 08:17:15 +10:00
Thomas Hindoe Paaboel Andersen
7e97936f0e
reset GError before reuse
...
If the error variable is not reset then we may end up freeing it
again in the next block. This can cause problems later for glib.
Fixes #311
2017-08-31 08:07:19 +10:00
Peter Hutterer
cfd93cf332
drop now obsolete ratbag_device_get_udev_property
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-28 17:50:20 +02:00
Peter Hutterer
340e5b7d86
Switch to a .ini-file based device database
...
The hwdb was a quick and easy way to add entries for new devices but we need
more and more info about the various types of devices. It's better to move
this to a proper database.
Side-effect: this also gives us an easy way to point to the list of devices
supported and makes checking for e.g. missing svgs easier.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-28 17:50:20 +02:00
Peter Hutterer
be624fe943
Move dpi range parsing to a helper function
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-28 17:50:20 +02:00
Peter Hutterer
cb102e115c
Add xasprintf
...
Like asprintf, but leaves strp as NULL on failure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-28 17:50:20 +02:00
Peter Hutterer
f4f206f3e5
Add missing config.h includes
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-08-28 09:18:00 +02:00
Clément Vuchener
49b7029506
hidpp: Fix error string array size
...
Extend error strings array so reading 0xFF as an error code would not overflow.
2017-08-18 04:26:50 +10:00
Clément Vuchener
468787601e
hidpp: Distinguish 1.0 and 2.0 error codes
2017-08-18 04:26:50 +10:00
Benjamin Tissoires
e0e4d5062a
hidpp20: fix resolution active set/get
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-07-28 16:19:26 +01:00
Benjamin Tissoires
7c313a31fd
tools: ratbagctl: fixes for specials
...
few minor issues which were unseen because driver-test was missing to set
the special key mappings
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-07-26 18:08:39 +02:00
Benjamin Tissoires
de3bb0e579
implement resolution active set ( #249 )
...
Fixes #80
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-07-26 08:32:16 +02:00
Peter Hutterer
5399d15658
ratbagd: add support for test device button types
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 18:24:10 +02:00
Peter Hutterer
5f98d8d029
ratbagd: rename test's button type to action_type
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 18:24:10 +02:00
Peter Hutterer
129551f3f4
ratbagd: add support for macros in the test device
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 17:17:03 +02:00
Peter Hutterer
4f62424e8a
driver-test: fix macro initialization
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 17:17:03 +02:00
Peter Hutterer
67e1c8667b
Change enum value of the unknown value type
...
Keeps the values as uints
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 16:47:27 +02:00
Peter Hutterer
0982d6a4a9
Drop libratbag as separate library
...
Now that ratbagd is part of libratbag, the DBus interface is the preferred way
to interact with a device. Shipping libratbag as a .so file means we have to
worry about two ABIs when it's unlikely that anyone ever uses the libratbag.so
directly.
Make it a static library internally instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2017-07-25 11:14:13 +10:00
Benjamin Tissoires
6faa59c70d
tools: ratbagctl: add support for separate X/Y resolutions
...
Big commit because of the test suite changes.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-07-25 11:09:24 +10:00
Benjamin Tissoires
ced958f135
hidpp10: implement enable/disable profiles
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2017-07-25 11:06:59 +10:00