Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions src/dsprpcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,62 @@

typedef int (*dsp_default_listener_start_t)(int argc, char *argv[]);

/**
* Prints help information about the daemon.
*/
static void print_help(const char *program_name, const char *dsp_name) {
printf("Usage: %s [OPTIONS]\n\n", program_name);
printf("Description:\n");
printf(" %s is a daemon that establishes a connection to the guest PD\n", program_name);
printf(" (Process Domain) on the %s, functioning similarly to the root\n", dsp_name);
printf(" process in Linux.\n\n");
printf("Functionality:\n");
printf(" - DSP Process Exception Logs:\n");
printf(" Facilitates transfer of %s process exception logs to the HLOS\n", dsp_name);
printf(" (High-Level Operating System) logging infrastructure for effective\n");
printf(" monitoring and debugging.\n\n");
printf(" - Fastrpc Shell File Execution:\n");
printf(" Enables execution of fastrpc shell file (executable file that runs\n");
printf(" as a process on the %s). When applications offload tasks to the %s\n", dsp_name, dsp_name);
printf(" but cannot access shell file directly, the daemon reads the shell\n");
printf(" file from the HLOS file system and creates the necessary process on\n");
printf(" the %s.\n\n", dsp_name);
printf(" Shell file naming format:\n");
#ifdef USE_ADSP
printf(" - Signed: fastrpc_shell_<domain_id> (ADSP supports signed only)\n\n");
#elif defined(USE_SDSP)
printf(" - Signed: fastrpc_shell_<domain_id> (SDSP supports signed only)\n\n");
#elif defined(USE_CDSP)
printf(" - Signed: fastrpc_shell_<domain_id>\n");
printf(" - Unsigned: fastrpc_shell_unsigned_<domain_id>\n\n");
#elif defined(USE_GDSP)
printf(" - Signed: fastrpc_shell_<domain_id>\n");
printf(" - Unsigned: fastrpc_shell_unsigned_<domain_id>\n\n");
#endif
printf("Options:\n");
printf(" -h, --help Display this help message and exit\n");
printf(" <pd_name> <domain> Start daemon for specific PD and domain\n");
#ifdef USE_ADSP
printf(" Example: %s audiopd adsp\n", program_name);
#elif defined(USE_SDSP)
printf(" Example: %s rootpd sdsp\n", program_name);
#elif defined(USE_CDSP)
printf(" Example: %s rootpd cdsp (or cdsp1)\n", program_name);
#elif defined(USE_GDSP)
printf(" Example: %s rootpd gdsp0 (or gdsp1)\n", program_name);
#endif
printf(" <pd_name> Start daemon for specific PD (uses default domain)\n");
#ifdef USE_ADSP
printf(" Example: %s audiopd\n", program_name);
#else
printf(" Example: %s rootpd\n", program_name);
#endif
printf(" (no arguments) Start daemon for root PD (default/guest OS)\n\n");
printf("Notes:\n");
printf(" - This daemon runs continuously and automatically restarts on errors\n");
printf(" - It exits only when the fastRPC device node is not accessible\n\n");
}

// Result struct for dlopen.
struct dlopen_result {
void *handle;
Expand Down Expand Up @@ -93,6 +149,15 @@ int main(int argc, char *argv[]) {
#else
goto bail;
#endif

// Check for help flag
if (argc > 1) {
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
print_help(argv[0], dsp_name);
return 0;
}
}

VERIFY_EPRINTF("%s daemon starting", dsp_name);

while (1) {
Expand Down
Loading