Skip to content

Commit c55dd19

Browse files
committed
dsprpcd: Add help functionality
Add -h/--help support to display daemon usage, functionality, DSP-specific shell file naming conventions, and command-line options with appropriate examples for each DSP subsystem. Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
1 parent 2d08520 commit c55dd19

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

src/dsprpcd.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,62 @@
3434

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

37+
/**
38+
* Prints help information about the daemon.
39+
*/
40+
static void print_help(const char *program_name, const char *dsp_name) {
41+
printf("Usage: %s [OPTIONS]\n\n", program_name);
42+
printf("Description:\n");
43+
printf(" %s is a daemon that establishes a connection to the guest PD\n", program_name);
44+
printf(" (Process Domain) on the %s, functioning similarly to the root\n", dsp_name);
45+
printf(" process in Linux.\n\n");
46+
printf("Functionality:\n");
47+
printf(" - DSP Process Exception Logs:\n");
48+
printf(" Facilitates transfer of %s process exception logs to the HLOS\n", dsp_name);
49+
printf(" (High-Level Operating System) logging infrastructure for effective\n");
50+
printf(" monitoring and debugging.\n\n");
51+
printf(" - Fastrpc Shell File Execution:\n");
52+
printf(" Enables execution of fastrpc shell file (executable file that runs\n");
53+
printf(" as a process on the %s). When applications offload tasks to the %s\n", dsp_name, dsp_name);
54+
printf(" but cannot access shell file directly, the daemon reads the shell\n");
55+
printf(" file from the HLOS file system and creates the necessary process on\n");
56+
printf(" the %s.\n\n", dsp_name);
57+
printf(" Shell file naming format:\n");
58+
#ifdef USE_ADSP
59+
printf(" - Signed: fastrpc_shell_<domain_id> (ADSP supports signed only)\n\n");
60+
#elif defined(USE_SDSP)
61+
printf(" - Signed: fastrpc_shell_<domain_id> (SDSP supports signed only)\n\n");
62+
#elif defined(USE_CDSP)
63+
printf(" - Signed: fastrpc_shell_<domain_id>\n");
64+
printf(" - Unsigned: fastrpc_shell_unsigned_<domain_id>\n\n");
65+
#elif defined(USE_GDSP)
66+
printf(" - Signed: fastrpc_shell_<domain_id>\n");
67+
printf(" - Unsigned: fastrpc_shell_unsigned_<domain_id>\n\n");
68+
#endif
69+
printf("Options:\n");
70+
printf(" -h, --help Display this help message and exit\n");
71+
printf(" <pd_name> <domain> Start daemon for specific PD and domain\n");
72+
#ifdef USE_ADSP
73+
printf(" Example: %s audiopd adsp\n", program_name);
74+
#elif defined(USE_SDSP)
75+
printf(" Example: %s rootpd sdsp\n", program_name);
76+
#elif defined(USE_CDSP)
77+
printf(" Example: %s rootpd cdsp (or cdsp1)\n", program_name);
78+
#elif defined(USE_GDSP)
79+
printf(" Example: %s rootpd gdsp0 (or gdsp1)\n", program_name);
80+
#endif
81+
printf(" <pd_name> Start daemon for specific PD (uses default domain)\n");
82+
#ifdef USE_ADSP
83+
printf(" Example: %s audiopd\n", program_name);
84+
#else
85+
printf(" Example: %s rootpd\n", program_name);
86+
#endif
87+
printf(" (no arguments) Start daemon for root PD (default/guest OS)\n\n");
88+
printf("Notes:\n");
89+
printf(" - This daemon runs continuously and automatically restarts on errors\n");
90+
printf(" - It exits only when the fastRPC device node is not accessible\n\n");
91+
}
92+
3793
// Result struct for dlopen.
3894
struct dlopen_result {
3995
void *handle;
@@ -93,6 +149,15 @@ int main(int argc, char *argv[]) {
93149
#else
94150
goto bail;
95151
#endif
152+
153+
// Check for help flag
154+
if (argc > 1) {
155+
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
156+
print_help(argv[0], dsp_name);
157+
return 0;
158+
}
159+
}
160+
96161
VERIFY_EPRINTF("%s daemon starting", dsp_name);
97162

98163
while (1) {

0 commit comments

Comments
 (0)