mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Fix drivers making profiles dirty while probing
Fixes drivers calling public API functions which should only be called by the consumers of the library. The real problem here is that we don't have a clear separation between driver API and public API. This is just a simple search and replace, so there be more such things.
This commit is contained in:
@@ -147,9 +147,9 @@ asus_driver_load_profile(struct ratbag_device *device, struct ratbag_profile *pr
|
||||
|
||||
switch (dpi_count) {
|
||||
case 2: /* 2 DPI presets */
|
||||
ratbag_profile_set_report_rate(profile, resolution_data.data2.rate);
|
||||
ratbag_profile_set_angle_snapping(profile, resolution_data.data2.snapping);
|
||||
ratbag_profile_set_debounce(profile, resolution_data.data2.response);
|
||||
profile->hz = resolution_data.data2.rate;
|
||||
profile->angle_snapping = resolution_data.data2.snapping;
|
||||
profile->debounce = resolution_data.data2.response;
|
||||
ratbag_profile_for_each_resolution(profile, resolution)
|
||||
ratbag_resolution_set_resolution(
|
||||
resolution,
|
||||
@@ -158,9 +158,9 @@ asus_driver_load_profile(struct ratbag_device *device, struct ratbag_profile *pr
|
||||
break;
|
||||
|
||||
case 4: /* 4 DPI presets */
|
||||
ratbag_profile_set_report_rate(profile, resolution_data.data4.rate);
|
||||
ratbag_profile_set_angle_snapping(profile, resolution_data.data4.snapping);
|
||||
ratbag_profile_set_debounce(profile, resolution_data.data4.response);
|
||||
profile->hz = resolution_data.data4.rate;
|
||||
profile->angle_snapping = resolution_data.data4.snapping;
|
||||
profile->debounce = resolution_data.data4.response;
|
||||
ratbag_profile_for_each_resolution(profile, resolution)
|
||||
ratbag_resolution_set_resolution(
|
||||
resolution,
|
||||
|
||||
@@ -426,7 +426,7 @@ etekcity_read_profile(struct ratbag_profile *profile)
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, report_rate);
|
||||
profile->hz = report_rate;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
dpi_x = setting_report->xres[resolution->index] * 50;
|
||||
|
||||
@@ -974,7 +974,7 @@ gskill_read_resolutions(struct ratbag_profile *profile,
|
||||
|
||||
hz = GSKILL_MAX_POLLING_RATE / (report->polling_rate + 1);
|
||||
ratbag_profile_set_report_rate_list(profile, rates, ARRAY_LENGTH(rates));
|
||||
ratbag_profile_set_report_rate(profile, hz);
|
||||
profile->hz = hz;
|
||||
|
||||
for (i = 0; i < report->dpi_num; i++) {
|
||||
_cleanup_resolution_ struct ratbag_resolution *resolution = NULL;
|
||||
|
||||
@@ -430,7 +430,7 @@ hidpp10drv_read_profile(struct ratbag_profile *profile)
|
||||
}
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, rates, ARRAY_LENGTH(rates));
|
||||
ratbag_profile_set_report_rate(profile, p.refresh_rate);
|
||||
profile->hz = p.refresh_rate;
|
||||
|
||||
ratbag_profile_for_each_button(profile, button)
|
||||
hidpp10drv_read_button(button);
|
||||
|
||||
@@ -1245,7 +1245,7 @@ hidpp20drv_read_profile_8100(struct ratbag_profile *profile)
|
||||
ratbag_profile_set_report_rate_list(profile,
|
||||
drv_data->report_rates,
|
||||
drv_data->num_report_rates);
|
||||
ratbag_profile_set_report_rate(profile, p->report_rate);
|
||||
profile->hz = p->report_rate;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -415,7 +415,7 @@ logitech_g300_read_profile(struct ratbag_profile *profile)
|
||||
hz = logitech_g300_raw_to_frequency(report->frequency);
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, &hz, 1);
|
||||
ratbag_profile_set_report_rate(profile, hz);
|
||||
profile->hz = hz;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
struct logitech_g300_resolution *res =
|
||||
|
||||
@@ -400,7 +400,7 @@ logitech_g600_read_profile(struct ratbag_profile *profile)
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, 1000 / (report->frequency + 1));
|
||||
profile->hz = 1000 / (report->frequency + 1);
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
resolution->dpi_x = report->dpi[resolution->index] * 50;
|
||||
|
||||
@@ -871,7 +871,7 @@ roccat_read_dpi(struct roccat_settings_report* settings, struct ratbag_profile*
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, report_rate);
|
||||
profile->hz = report_rate;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
dpi_x = settings->xres[resolution->index] * 100 + 100;
|
||||
|
||||
@@ -684,7 +684,7 @@ roccat_read_profile(struct ratbag_profile *profile)
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, report_rate);
|
||||
profile->hz = report_rate;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
dpi_x = setting_report->xres[resolution->index] * 50;
|
||||
|
||||
@@ -679,7 +679,7 @@ roccat_read_profile(struct ratbag_profile *profile)
|
||||
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, report_rate);
|
||||
profile->hz = report_rate;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
dpi_x = setting_report->xres[resolution->index] * 50;
|
||||
|
||||
@@ -1146,7 +1146,7 @@ sinowealth_update_profile_from_config(struct ratbag_profile *profile)
|
||||
|
||||
/* Report rate */
|
||||
const unsigned int hz = sinowealth_raw_to_report_rate(config->report_rate);
|
||||
ratbag_profile_set_report_rate(profile, hz);
|
||||
profile->hz = hz;
|
||||
|
||||
unsigned int enabled_dpi_count = 0;
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
|
||||
@@ -348,7 +348,7 @@ steelseries_probe(struct ratbag_device *device)
|
||||
ratbag_profile_set_cap(profile, RATBAG_PROFILE_CAP_WRITE_ONLY);
|
||||
ratbag_profile_set_report_rate_list(profile, report_rates,
|
||||
ARRAY_LENGTH(report_rates));
|
||||
ratbag_profile_set_report_rate(profile, 1000);
|
||||
profile->hz = 1000;
|
||||
|
||||
ratbag_profile_for_each_resolution(profile, resolution) {
|
||||
if (resolution->index == 0) {
|
||||
|
||||
@@ -162,7 +162,7 @@ test_read_profile(struct ratbag_profile *profile)
|
||||
ratbag_profile_set_report_rate_list(profile,
|
||||
p0->report_rates,
|
||||
nrates);
|
||||
ratbag_profile_set_report_rate(profile, p->hz);
|
||||
profile->hz = p->hz;
|
||||
|
||||
for (i = 0; i < d->num_resolutions; i++) {
|
||||
_cleanup_resolution_ struct ratbag_resolution *res = NULL;
|
||||
|
||||
Reference in New Issue
Block a user