]> code.delx.au - pulseaudio/blobdiff - src/modules/module-udev-detect.c
alsa-mixer: Add a few more machines to internal mic whitelist
[pulseaudio] / src / modules / module-udev-detect.c
index c5312a811446f01049702b7f1b5ec952e046767e..31416bd3a462a5160f2d8791c5798a39bd896dcb 100644 (file)
@@ -45,6 +45,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
 PA_MODULE_USAGE(
         "tsched=<enable system timer based scheduling mode?> "
+        "fixed_latency_range=<disable latency range changes on underrun?> "
         "ignore_dB=<ignore dB information from the device?> "
         "deferred_volume=<syncronize sw and hw volume changes in IO-thread?>");
 
@@ -62,6 +63,7 @@ struct userdata {
     pa_hashmap *devices;
 
     pa_bool_t use_tsched:1;
+    pa_bool_t fixed_latency_range:1;
     pa_bool_t ignore_dB:1;
     pa_bool_t deferred_volume:1;
 
@@ -75,6 +77,7 @@ struct userdata {
 
 static const char* const valid_modargs[] = {
     "tsched",
+    "fixed_latency_range",
     "ignore_dB",
     "deferred_volume",
     NULL
@@ -120,7 +123,7 @@ static char *card_get_sysattr(const char *card_idx, const char *name) {
         goto finish;
     }
 
-    t = pa_sprintf_malloc("%s/class/sound/card%s", udev_get_sys_path(udev), card_idx);
+    t = pa_sprintf_malloc("/sys/class/sound/card%s", card_idx);
     card = udev_device_new_from_syspath(udev, t);
     pa_xfree(t);
 
@@ -279,7 +282,7 @@ static void verify_access(struct userdata *u, struct device *d) {
     pa_assert(u);
     pa_assert(d);
 
-    cd = pa_sprintf_malloc("%s/snd/controlC%s", udev_get_dev_path(u->udev), path_get_card_id(d->path));
+    cd = pa_sprintf_malloc("/dev/snd/controlC%s", path_get_card_id(d->path));
     accessible = access(cd, R_OK|W_OK) >= 0;
     pa_log_debug("%s is accessible: %s", cd, pa_yes_no(accessible));
 
@@ -388,6 +391,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
                                 "card_name=\"%s\" "
                                 "namereg_fail=false "
                                 "tsched=%s "
+                                "fixed_latency_range=%s "
                                 "ignore_dB=%s "
                                 "deferred_volume=%s "
                                 "card_properties=\"module-udev-detect.discovered=1\"",
@@ -395,6 +399,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
                                 n,
                                 d->card_name,
                                 pa_yes_no(u->use_tsched),
+                                pa_yes_no(u->fixed_latency_range),
                                 pa_yes_no(u->ignore_dB),
                                 pa_yes_no(u->deferred_volume));
     pa_xfree(n);
@@ -616,7 +621,6 @@ fail:
 }
 
 static int setup_inotify(struct userdata *u) {
-    char *dev_snd;
     int r;
 
     if (u->inotify_fd >= 0)
@@ -627,9 +631,7 @@ static int setup_inotify(struct userdata *u) {
         return -1;
     }
 
-    dev_snd = pa_sprintf_malloc("%s/snd", udev_get_dev_path(u->udev));
-    r = inotify_add_watch(u->inotify_fd, dev_snd, IN_ATTRIB|IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
-    pa_xfree(dev_snd);
+    r = inotify_add_watch(u->inotify_fd, "/dev/snd", IN_ATTRIB|IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
 
     if (r < 0) {
         int saved_errno = errno;
@@ -665,7 +667,7 @@ int pa__init(pa_module *m) {
     struct udev_enumerate *enumerate = NULL;
     struct udev_list_entry *item = NULL, *first = NULL;
     int fd;
-    pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume;
+    pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume;
 
 
     pa_assert(m);
@@ -686,6 +688,12 @@ int pa__init(pa_module *m) {
     }
     u->use_tsched = use_tsched;
 
+    if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) {
+        pa_log("Failed to parse fixed_latency_range= argument.");
+        goto fail;
+    }
+    u->fixed_latency_range = fixed_latency_range;
+
     if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) {
         pa_log("Failed to parse ignore_dB= argument.");
         goto fail;