With the swtich to the commit style the function
hidpp10drv_write_resolution_dpi is doing too much work.
Before commit style the function would:
* get the profile
* get the current resolution
* write the profile (resets it to default dpi)
* set the current (updated) resolution
With the commit style we call the function for every resolution
in every dirty profile we now:
* get the current resolution
* set the current (updated) resolution
Then later:
* write the profile (resets to default dpi)
This patch changes this to only doing one set of the current resolution
when the active profile has been written. This reduces the traffic to the
device and sets the current resolution after the profile write.
For the device I have I do not see a way to get
this information by querying the device.
If the value is set in the .device file it will
override anything that the hidpp10 driver itself
would have found.
1-bit RGB is needed for the Logitech G300, let's rename the main RGB to
indicate how many bits we actually have.
See #335
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The initial value of 400 in the enum is chosen so it looks weird when someone
tries to interpret the value as integer. Values of 1, 2, 4, etc. could be
confused with something realistic.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Writing multiple changed profiles was broken as we would exit the
loop after the first profile write. We were returning the number
of bytes written and this was interpreted as an error.
Fix it my returning 0 when we have written the correct number of
bytes to the mouse.
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>
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>
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>
allocate was actually both initializing and allocating through initialize.
Things started to get complicated.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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.
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>
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>