udev-detect: Add sync_volume parameter

Signed-off-by: Jyri Sarha <jyri.sarha@nokia.com>
Reviewed-by: Tanu Kaskinen <tanu.kaskinen@digia.com>
Reviewd-by: Colin Guthrie <cguthrie@mandriva.org>
This commit is contained in:
Jyri Sarha 2010-10-15 13:05:16 +03:00 committed by Colin Guthrie
parent 1bea955829
commit 43b3f39a2f

View file

@ -45,7 +45,8 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> " "tsched=<enable system timer based scheduling mode?> "
"ignore_dB=<ignore dB information from the device?>"); "ignore_dB=<ignore dB information from the device?> "
"sync_volume=<syncronize sw and hw voluchanges in IO-thread?>");
struct device { struct device {
char *path; char *path;
@ -62,6 +63,7 @@ struct userdata {
pa_bool_t use_tsched:1; pa_bool_t use_tsched:1;
pa_bool_t ignore_dB:1; pa_bool_t ignore_dB:1;
pa_bool_t sync_volume:1;
struct udev* udev; struct udev* udev;
struct udev_monitor *monitor; struct udev_monitor *monitor;
@ -74,6 +76,7 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"tsched", "tsched",
"ignore_dB", "ignore_dB",
"sync_volume",
NULL NULL
}; };
@ -386,12 +389,14 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
"namereg_fail=false " "namereg_fail=false "
"tsched=%s " "tsched=%s "
"ignore_dB=%s " "ignore_dB=%s "
"sync_volume=%s "
"card_properties=\"module-udev-detect.discovered=1\"", "card_properties=\"module-udev-detect.discovered=1\"",
path_get_card_id(path), path_get_card_id(path),
n, n,
d->card_name, d->card_name,
pa_yes_no(u->use_tsched), pa_yes_no(u->use_tsched),
pa_yes_no(u->ignore_dB)); pa_yes_no(u->ignore_dB),
pa_yes_no(u->sync_volume));
pa_xfree(n); pa_xfree(n);
pa_hashmap_put(u->devices, d->path, d); pa_hashmap_put(u->devices, d->path, d);
@ -661,7 +666,8 @@ int pa__init(pa_module *m) {
struct udev_enumerate *enumerate = NULL; struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *item = NULL, *first = NULL; struct udev_list_entry *item = NULL, *first = NULL;
int fd; int fd;
pa_bool_t use_tsched = TRUE, ignore_dB = FALSE; pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = FALSE;
pa_assert(m); pa_assert(m);
@ -687,6 +693,12 @@ int pa__init(pa_module *m) {
} }
u->ignore_dB = ignore_dB; u->ignore_dB = ignore_dB;
if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) {
pa_log("Failed to parse sync_volume= argument.");
goto fail;
}
u->sync_volume = sync_volume;
if (!(u->udev = udev_new())) { if (!(u->udev = udev_new())) {
pa_log("Failed to initialize udev library."); pa_log("Failed to initialize udev library.");
goto fail; goto fail;