mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
driver-hidpp20: re-enable changing the report rate
Fixes bf127d4c68
Related: #692
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
committed by
Peter Hutterer
parent
fc16a8dc7c
commit
6f27053ab0
@@ -897,6 +897,34 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp20drv_update_report_rate_8100(struct ratbag_profile *profile, int hz)
|
||||
{
|
||||
struct ratbag_device *device = profile->device;
|
||||
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
|
||||
struct hidpp20_profile *h_profile;
|
||||
|
||||
h_profile = &drv_data->profiles->profiles[profile->index];
|
||||
h_profile->report_rate = hz;
|
||||
|
||||
return RATBAG_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp20drv_update_report_rate(struct ratbag_profile *profile, int hz)
|
||||
{
|
||||
struct ratbag_device *device = profile->device;
|
||||
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
|
||||
|
||||
if (drv_data->capabilities & HIDPP_CAP_ONBOARD_PROFILES_8100)
|
||||
return hidpp20drv_update_report_rate_8100(profile, hz);
|
||||
|
||||
if (drv_data->capabilities & HIDPP_CAP_ADJUSTIBLE_REPORT_RATE_8060)
|
||||
return -ENOTSUP;
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp20drv_read_special_key_mouse(struct ratbag_device *device)
|
||||
{
|
||||
@@ -1213,9 +1241,15 @@ hidpp20drv_commit(struct ratbag_device *device)
|
||||
if (!profile->dirty)
|
||||
continue;
|
||||
|
||||
rc = hidpp20drv_update_report_rate(profile, profile->hz);
|
||||
if (rc)
|
||||
return RATBAG_ERROR_DEVICE;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
if (resolution->is_active)
|
||||
if (resolution->is_active) {
|
||||
log_raw(device->ratbag, "dpi index: %d, profile %d\n", resolution->index, profile->index);
|
||||
dpi_index = resolution->index;
|
||||
}
|
||||
|
||||
rc = hidpp20drv_update_resolution_dpi(resolution,
|
||||
resolution->dpi_x,
|
||||
|
||||
@@ -399,6 +399,7 @@ def func_report_rate_get_all(r, args):
|
||||
def func_report_rate_set(r, args):
|
||||
p, d = find_profile(r, args)
|
||||
p.report_rate = args.rate_n
|
||||
commit(d, args)
|
||||
|
||||
|
||||
def func_resolution_get(r, args):
|
||||
|
||||
Reference in New Issue
Block a user