From 1866d65b9ee82e8048981fefa18757a55cc6b4eb Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 Jan 2024 02:15:06 +0100 Subject: [PATCH] Ability to disable IMU --- allynone.c | 1 + config.cfg.default | 3 ++- main.c | 1 + rog_ally.c | 7 +++++-- settings.c | 7 +++++++ settings.h | 1 + 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/allynone.c b/allynone.c index 3f3ecbe..304cf61 100644 --- a/allynone.c +++ b/allynone.c @@ -25,6 +25,7 @@ int main(int argc, char ** argv) { .enable_thermal_profiles_switching = false, .default_thermal_profile = -1, .enable_leds_commands = false, + .enable_imu = true, }; load_in_config(&in_settings, configuration_file); diff --git a/config.cfg.default b/config.cfg.default index 8fb3b16..2d8ffe9 100644 --- a/config.cfg.default +++ b/config.cfg.default @@ -14,4 +14,5 @@ dualsense_edge = false; swap_y_z = true; enable_thermal_profiles_switching = true; default_thermal_profile = -1; -enable_leds_commands = true; \ No newline at end of file +enable_leds_commands = true; +enable_imu = true; \ No newline at end of file diff --git a/main.c b/main.c index e1822ab..17d94a4 100644 --- a/main.c +++ b/main.c @@ -24,6 +24,7 @@ int main(int argc, char ** argv) { .enable_thermal_profiles_switching = false, .default_thermal_profile = -1, .enable_leds_commands = false, + .enable_imu = true, }; load_in_config(&in_settings, configuration_file); diff --git a/rog_ally.c b/rog_ally.c index cdf4a32..0f20bba 100644 --- a/rog_ally.c +++ b/rog_ally.c @@ -1516,19 +1516,22 @@ input_dev_t timer_dev = { input_dev_composite_t rc71l_composite = { .dev = { &in_xbox_dev, - &in_iio_dev, &in_asus_kb_1_dev, &in_asus_kb_2_dev, &in_asus_kb_3_dev, &timer_dev, }, - .dev_count = 6, + .dev_count = 5, .init_fn = rc71l_platform_init, .deinit_fn = rc71l_platform_deinit, .leds_fn = rc71l_platform_leds, }; input_dev_composite_t* rog_ally_device_def(const dev_in_settings_t *const conf) { + if (conf->enable_imu) { + rc71l_composite.dev[rc71l_composite.dev_count++] = &in_iio_dev; + } + if (conf->touchbar) { rc71l_composite.dev[rc71l_composite.dev_count++] = &in_touchscreen_dev; } diff --git a/settings.c b/settings.c index 31c80fe..3a8da9d 100644 --- a/settings.c +++ b/settings.c @@ -76,6 +76,13 @@ void load_in_config(dev_in_settings_t *const out_conf, const char* const filepat fprintf(stderr, "enable_leds_commands (bool) configuration not found. Default value will be used.\n"); } + int enable_imu; + if (config_lookup_bool(&cfg, "enable_imu", &enable_imu) != CONFIG_FALSE) { + out_conf->enable_imu = enable_imu; + } else { + fprintf(stderr, "enable_imu (bool) configuration not found. Default value will be used.\n"); + } + config_destroy(&cfg); load_in_config_err: diff --git a/settings.h b/settings.h index 2cacd0f..5576d54 100644 --- a/settings.h +++ b/settings.h @@ -11,6 +11,7 @@ typedef struct dev_in_settings { bool enable_thermal_profiles_switching; int default_thermal_profile; bool enable_leds_commands; + bool enable_imu; } dev_in_settings_t; void load_in_config(dev_in_settings_t *const out_conf, const char* const filepath);