Skip to content

Commit

Permalink
Fix sleep issie: allow using IMU polling interface in bmi323-imu too
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroReflex committed Jan 15, 2024
1 parent c8e81eb commit 8c8a488
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions allynone.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int main(int argc, char ** argv) {
.default_thermal_profile = -1,
.enable_leds_commands = false,
.enable_imu = true,
.imu_polling_interface = true,
};

load_in_config(&in_settings, configuration_file);
Expand Down
3 changes: 2 additions & 1 deletion config.cfg.default
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ swap_y_z = true;
enable_thermal_profiles_switching = true;
default_thermal_profile = -1;
enable_leds_commands = true;
enable_imu = true;
enable_imu = true;
imu_polling_interface = true;
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ int main(int argc, char ** argv) {
.default_thermal_profile = -1,
.enable_leds_commands = false,
.enable_imu = true,
.imu_polling_interface = true,
};

load_in_config(&in_settings, configuration_file);
Expand Down
4 changes: 4 additions & 0 deletions rog_ally.c
Original file line number Diff line number Diff line change
Expand Up @@ -2046,6 +2046,10 @@ input_dev_composite_t* rog_ally_device_def(const dev_in_settings_t *const conf)
if ((bmc15_timer_data.name != NULL) && (strcmp(bmc15_timer_data.name, "bmi323"))) {
printf("Old bmc150-accel-i2c for bmi323 device has been selected! Are you running a neptune kernel?\n");
rc71l_composite.dev[rc71l_composite.dev_count++] = &bmc150_timer_dev;
} else if ((conf->imu_polling_interface)) {
if (bmc15_timer_data.name != NULL) {
printf("Forced polling on a %s, suspend/resume issues?\n", bmc15_timer_data.name);
}
} else {
printf("Using the newer upstreamed bmi323-imu driver\n");
rc71l_composite.dev[rc71l_composite.dev_count++] = &in_iio_dev;
Expand Down
7 changes: 7 additions & 0 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ void load_in_config(dev_in_settings_t *const out_conf, const char* const filepat
fprintf(stderr, "enable_imu (bool) configuration not found. Default value will be used.\n");
}

int imu_polling_interface;
if (config_lookup_bool(&cfg, "imu_polling_interface", &imu_polling_interface) != CONFIG_FALSE) {
out_conf->imu_polling_interface = imu_polling_interface;
} else {
fprintf(stderr, "imu_polling_interface (bool) configuration not found. Default value will be used.\n");
}

config_destroy(&cfg);

load_in_config_err:
Expand Down
1 change: 1 addition & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef struct dev_in_settings {
int default_thermal_profile;
bool enable_leds_commands;
bool enable_imu;
bool imu_polling_interface;
} dev_in_settings_t;

void load_in_config(dev_in_settings_t *const out_conf, const char* const filepath);
Expand Down

0 comments on commit 8c8a488

Please sign in to comment.