use udev only for usb devices - samsung
authorJaska Uimonen <jaska.uimonen@intel.com>
Thu, 8 Aug 2013 08:28:39 +0000 (11:28 +0300)
committerJaska Uimonen <jaska.uimonen@intel.com>
Wed, 12 Mar 2014 08:55:39 +0000 (10:55 +0200)
Change-Id: Ia8cd2f5eb5ebe5248af11906c67d572ede133b33
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
configure.ac
src/modules/alsa/module-alsa-card.c
src/modules/module-udev-detect.c

index e0043db..811916e 100644 (file)
@@ -1115,8 +1115,18 @@ AC_SUBST(HAVE_UDEV)
 AM_CONDITIONAL([HAVE_UDEV], [test "x$HAVE_UDEV" = x1])
 AS_IF([test "x$HAVE_UDEV" = "x1"], AC_DEFINE([HAVE_UDEV], 1, [Have UDEV.]))
 
-#### HAL compat support (optional, dependent on UDEV) ####
+#### udev for usb _only_ support (optional, dependant on UDEV) ####
+AC_ARG_ENABLE([udev_with_usb_only],
+    AS_HELP_STRING([--enable-udev-with-usb-only],[Enable UDEV with only USB support]))
+
+AS_IF([test "x$enable_udev_with_usb_only" != "xyes"],
+    [AS_IF([test "x$HAVE_UDEV" = "x1"], HAVE_UDEV_ONLY_USB=0, HAVE_UDEV_ONLY_USB=1)],
+    HAVE_UDEV_ONLY_USB=1)
 
+AM_CONDITIONAL([HAVE_UDEV_ONLY_USB], [test "x$HAVE_UDEV_ONLY_USB" = x1])
+AS_IF([test "x$HAVE_UDEV_ONLY_USB" = "x1"], AC_DEFINE([HAVE_UDEV_ONLY_USB], 1, [Have usb only with udev.]))
+
+#### HAL compat support (optional, dependent on UDEV) ####
 AC_ARG_ENABLE([hal-compat],
     AS_HELP_STRING([--disable-hal-compat],[Disable optional HAL->udev transition compatibility support]))
 
@@ -1510,6 +1520,7 @@ AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" = "x1"], ENABLE_SYSTEMD_JOURNAL=yes, ENABLE
 AS_IF([test "x$HAVE_BLUEZ_4" = "x1"], ENABLE_BLUEZ_4=yes, ENABLE_BLUEZ_4=no)
 AS_IF([test "x$HAVE_BLUEZ_5" = "x1"], ENABLE_BLUEZ_5=yes, ENABLE_BLUEZ_5=no)
 AS_IF([test "x$HAVE_HAL_COMPAT" = "x1"], ENABLE_HAL_COMPAT=yes, ENABLE_HAL_COMPAT=no)
+AS_IF([test "x$HAVE_UDEV_ONLY_USB" = "x1"], ENABLE_UDEV_ONLY_USB=yes, ENABLE_UDEV_ONLY_USB=no)
 AS_IF([test "x$HAVE_TCPWRAP" = "x1"], ENABLE_TCPWRAP=yes, ENABLE_TCPWRAP=no)
 AS_IF([test "x$HAVE_LIBSAMPLERATE" = "x1"], ENABLE_LIBSAMPLERATE=yes, ENABLE_LIBSAMPLERATE=no)
 AS_IF([test "x$HAVE_IPV6" = "x1"], ENABLE_IPV6=yes, ENABLE_IPV6=no)
@@ -1565,6 +1576,7 @@ echo "
         headset backed:            ${BLUETOOTH_HEADSET_BACKEND}
     Enable udev:                   ${ENABLE_UDEV}
       Enable HAL->udev compat:     ${ENABLE_HAL_COMPAT}
+      Enable udev usb only:        ${ENABLE_UDEV_ONLY_USB}
     Enable systemd login:          ${ENABLE_SYSTEMD}
     Enable systemd journal:        ${ENABLE_SYSTEMD_JOURNAL}
     Enable TCP Wrappers:           ${ENABLE_TCPWRAP}
index cf54c0f..1e63230 100644 (file)
@@ -678,6 +678,13 @@ int pa__init(pa_module *m) {
         u->use_ucm = false;
 #ifdef HAVE_UDEV
         fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET");
+#ifdef ENABLE_UDEV_ONLY_USB
+       pa_log("PULSE_PROFILE_SET = %s", fn);
+       if (fn == NULL) {
+            fn = strdup ("tizen_usb.conf");
+           pa_log("(new) PULSE_PROFILE_SET = %s", fn);
+    }
+#endif
 #endif
 
         if (pa_modargs_get_value(u->modargs, "profile_set", NULL)) {
index c28c867..1e8fb06 100644 (file)
@@ -464,6 +464,23 @@ static void process_device(struct userdata *u, struct udev_device *dev) {
         return;
     }
 
+    pa_log_debug ("devpath = %s", udev_device_get_devpath(dev));
+    pa_log_debug ("subsystem = %s", udev_device_get_subsystem(dev));
+    pa_log_debug ("devtype = %s", udev_device_get_devtype(dev));
+    pa_log_debug ("syspath = %s", udev_device_get_syspath(dev));
+    pa_log_debug ("sysname = %s", udev_device_get_sysname(dev));
+    pa_log_debug ("sysnum = %s", udev_device_get_sysnum(dev));
+    pa_log_debug ("devnode = %s", udev_device_get_devnode(dev));
+    pa_log_debug ("parent subsystem = %s", udev_device_get_subsystem(udev_device_get_parent(dev)));
+
+#ifdef ENABLE_UDEV_ONLY_USB
+    /* If parent's subsystem is not USB, return */
+    if (!pa_streq(udev_device_get_subsystem(udev_device_get_parent(dev)), "usb")) {
+        pa_log_debug("Ignoring %s, because it's parent subsystem is not a USB.", udev_device_get_devpath(dev));
+        return;
+    }
+#endif
+
     action = udev_device_get_action(dev);
 
     if (action && pa_streq(action, "remove"))