From 614f8ff2dbd78a3f8338fad5b7134d04f31d9f3a Mon Sep 17 00:00:00 2001 From: icex2 Date: Mon, 12 Apr 2021 22:04:51 +0200 Subject: [PATCH] patch/pro 1 and 2: Delay polls to ctrl endpoint for 1 ms each Fixes high CPU load issues with IO threads --- src/main/hook/pro/main.c | 8 ++++++-- src/main/hook/pro2/main.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/hook/pro/main.c b/src/main/hook/pro/main.c index 46fc331..db7c4c4 100644 --- a/src/main/hook/pro/main.c +++ b/src/main/hook/pro/main.c @@ -183,7 +183,9 @@ static void prohook_patch_piuio_init(struct prohook_options *options) if (options->patch.piuio.api_lib) { char *abs_path_iolib = util_fs_get_abs_path(options->patch.piuio.api_lib); - patch_piuio_init(abs_path_iolib); + // piuio thread is relying on hardware load. If this doesn't really exist, + // e.g. device software emulation, the thread will consume A LOT of CPU + patch_piuio_init(abs_path_iolib, 1); free(abs_path_iolib); } } @@ -193,7 +195,9 @@ static void prohook_patch_piubtn_init(struct prohook_options *options) if (options->patch.piubtn.api_lib) { char *abs_path_btnlib = util_fs_get_abs_path(options->patch.piubtn.api_lib); - patch_piubtn_init(abs_path_btnlib); + // piubtn thread is relying on hardware load. If this doesn't really exist, + // e.g. device software emulation, the thread will consume A LOT of CPU + patch_piubtn_init(abs_path_btnlib, 1); free(abs_path_btnlib); } } diff --git a/src/main/hook/pro2/main.c b/src/main/hook/pro2/main.c index 81fd3b7..cfadcfb 100644 --- a/src/main/hook/pro2/main.c +++ b/src/main/hook/pro2/main.c @@ -191,7 +191,9 @@ static void pro2hook_patch_piuio_init(struct pro2hook_options *options) if (options->patch.piuio.api_lib) { char *abs_path_iolib = util_fs_get_abs_path(options->patch.piuio.api_lib); - patch_piuio_init(abs_path_iolib); + // piuio thread is relying on hardware load. If this doesn't really exist, + // e.g. device software emulation, the thread will consume A LOT of CPU + patch_piuio_init(abs_path_iolib, 1); free(abs_path_iolib); } } @@ -201,7 +203,9 @@ static void pro2hook_patch_piubtn_init(struct pro2hook_options *options) if (options->patch.piubtn.api_lib) { char *abs_path_btnlib = util_fs_get_abs_path(options->patch.piubtn.api_lib); - patch_piubtn_init(abs_path_btnlib); + // piubtn thread is relying on hardware load. If this doesn't really exist, + // e.g. device software emulation, the thread will consume A LOT of CPU + patch_piubtn_init(abs_path_btnlib, 1); free(abs_path_btnlib); } }