mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
Add new CLI option, separate auto-detect and auto-connect
This commit is contained in:
13
cli.cpp
13
cli.cpp
@@ -32,6 +32,7 @@ enum
|
||||
RET_FLAG_NO_DETECT = 16,
|
||||
RET_FLAG_CLI_POST_DETECTION = 32,
|
||||
RET_FLAG_START_SERVER = 64,
|
||||
RET_FLAG_NO_AUTO_CONNECT = 128,
|
||||
};
|
||||
|
||||
struct DeviceOptions
|
||||
@@ -375,7 +376,8 @@ void OptionHelp()
|
||||
help_text += " There is a risk of bricking your motherboard, RGB controller, and RAM if you send invalid SMBus/I2C transactions.\n";
|
||||
help_text += "--localconfig Use the current working directory instead of the global configuration directory.\n";
|
||||
help_text += "--config path Use a custom path instead of the global configuration directory.\n";
|
||||
help_text += "--nodetect Do not try to detect hardware or autoconnect to a local server at startup.\n";
|
||||
help_text += "--nodetect Do not try to detect hardware at startup.\n";
|
||||
help_text += "--noautoconnect Do not try to autoconnect to a local server at startup.\n";
|
||||
|
||||
std::cout << help_text << std::endl;
|
||||
}
|
||||
@@ -983,6 +985,15 @@ unsigned int cli_pre_detection(int argc, char *argv[])
|
||||
cfg_args++;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| --noautoconnect |
|
||||
\*---------------------------------------------------------*/
|
||||
else if(option == "--noautoconnect")
|
||||
{
|
||||
ret_flags |= RET_FLAG_NO_AUTO_CONNECT;
|
||||
cfg_args++;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| --client |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
16
main.cpp
16
main.cpp
@@ -37,6 +37,7 @@ enum
|
||||
RET_FLAG_NO_DETECT = 16,
|
||||
RET_FLAG_CLI_POST_DETECTION = 32,
|
||||
RET_FLAG_START_SERVER = 64,
|
||||
RET_FLAG_NO_AUTO_CONNECT = 128,
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
@@ -173,15 +174,13 @@ int main(int argc, char* argv[])
|
||||
| Perform local connection and/or hardware detection if not |
|
||||
| disabled from CLI |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!(ret_flags & RET_FLAG_NO_DETECT))
|
||||
if(!(ret_flags & RET_FLAG_NO_AUTO_CONNECT))
|
||||
{
|
||||
printf("Attempting to connect to local OpenRGB server.\r\n");
|
||||
|
||||
if(!AttemptLocalConnection())
|
||||
{
|
||||
printf("Local OpenRGB server unavailable, running standalone.\r\n");
|
||||
|
||||
ResourceManager::get()->DetectDevices();
|
||||
printf("Local OpenRGB server unavailable.\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -191,6 +190,15 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Perform hardware detection if not disabled from CLI |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!(ret_flags & RET_FLAG_NO_DETECT))
|
||||
{
|
||||
printf("Running standalone.\r\n");
|
||||
ResourceManager::get()->DetectDevices();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Start the server if requested from CLI (this must be done |
|
||||
| after attempting local connection!) |
|
||||
|
||||
Reference in New Issue
Block a user