pulse-server: actually print properties of module

When inspecting the loaded modules, actually list the properties that
were used when loading the module instead of the informational generic
ones from the info.

Pulsaudio also does not list the Usage properties when listing modules.
This commit is contained in:
Wim Taymans 2026-06-25 09:10:47 +02:00
parent 9bcbd7b586
commit d97a9bf44b
4 changed files with 41 additions and 22 deletions

View file

@ -376,6 +376,8 @@ struct module *module_create(struct impl *impl, const char *name, const char *ar
errno = -res;
goto error_free;
}
if (info->properties)
pw_properties_update(module->props, info->properties);
if ((res = module->info->prepare(module)) < 0) {
errno = -res;
@ -414,3 +416,37 @@ struct module *module_lookup(struct impl *impl, uint32_t index, const char *name
}
return NULL;
}
char *module_info_usage(const struct module_info *i)
{
const struct module_args *a;
FILE *f;
size_t size;
char *res;
f = open_memstream(&res, &size);
if (f == NULL)
return NULL;
for (a = i->valid_args; a->key; a++) {
fprintf(f, "%s=<%s", a->key, a->type);
if (a->def)
fprintf(f, ", default %s", a->def);
fprintf(f, ", %s", a->description);
if (a->vals) {
const char **v;
fprintf(f, " [");
for (v = a->vals; *v; v++)
fprintf(f, "%s%s", v == a->vals ? "" : "|", *v);
fprintf(f, "]");
}
if (a->flags & MODULE_ARG_MANDATORY)
fprintf(f, " (mandatory)");
if (a->flags & MODULE_ARG_ENOTIMPL)
fprintf(f, " (not implemented)");
fprintf(f, ">");
}
fclose(f);
return res;
}