Added --i2c command line option

This commit is contained in:
2025-02-16 22:28:16 -08:00
parent c4e7f7e8b9
commit 7cd23384f6
4 changed files with 26 additions and 6 deletions
+13 -3
View File
@@ -24,7 +24,8 @@ char *header_start = "";
char *header_end = "";
static const char helpstring[] = "Available options:\n"
"--gpu N : Control only GPU N instead of all supported cards\n"
"--i2c N : Only probe I2C bus N instead of all (may help with stuttering with --watch)\n"
"--gpu N : Control only GPU N instead of all supported cards\n"
"--fan SPEED : Set all fans at once to SPEED (see below)\n"
"--fanN SPEED : Set fan N (0-3) to SPEED\n"
" SPEED may be one of the following:\n"
@@ -47,13 +48,22 @@ int main (int argc, char **argv)
int print_info = 0;
int compact = 0;
int gpu_num = -1; /* Card to control */
int i2c_bus = -1;
int overwrite = 0;
unsigned int watch = 0;
char *fan_speed[ICX3_MAX_FANS] = {NULL};
/* Input parsing */
for (int i = 1; i < argc; i++){
if (strcmp(argv[i], "--gpu") == 0) {
if (strcmp(argv[i], "--i2c") == 0) {
i++;
if (i < argc) {
i2c_bus = atoi(argv[i]);
} else {
printf(helpstring);
return -1;
}
} else if (strcmp(argv[i], "--gpu") == 0) {
i++;
if (i < argc) {
gpu_num = atoi(argv[i]);
@@ -119,7 +129,7 @@ int main (int argc, char **argv)
if (overwrite && !compact)
overwrite = 0;
gpu_count = find_evga_gpu_i2cs(gpus, MAX_GPUS);
gpu_count = find_evga_gpu_i2cs(gpus, MAX_GPUS, i2c_bus);
if (gpu_count == -1) {
printf("Error scanning I2C devices\n");