From 9ae05a9c6216ba7918c25b4f5442a45f9ee7f2cc Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Thu, 8 Aug 2013 11:28:39 +0300 Subject: [PATCH] use udev only for usb devices - samsung Change-Id: Ia8cd2f5eb5ebe5248af11906c67d572ede133b33 Signed-off-by: Jaska Uimonen --- configure.ac | 14 +++++++++++++- src/modules/alsa/module-alsa-card.c | 7 +++++++ src/modules/module-udev-detect.c | 17 +++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ebff16c..13c8f6c 100644 --- a/configure.ac +++ b/configure.ac @@ -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])) @@ -1511,6 +1521,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) @@ -1566,6 +1577,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} diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index cf54c0f..1e63230 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -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)) { diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c index c28c867..1e8fb06 100644 --- a/src/modules/module-udev-detect.c +++ b/src/modules/module-udev-detect.c @@ -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")) -- 2.7.4