[pulseaudio-discuss] [PATCH 1/3] udev: use ID_MODEL/ID_VENDOR to give friendly name for FireWire devices

David Henningsson david.henningsson at canonical.com
Tue Mar 31 05:38:02 PDT 2015


From: Takashi Sakamoto <o-takashi at sakamocchi.jp>

For recently supported FireWire sound devices, udev's database assign
the name of IEEE 1394 Phy/Link chipset to ID_XXX_FROM_DATABASE. This is
not friently names to users.

This commit applies a workaround to skip ID_XXX_FROM_DATABASE for any
FireWire devices.

[Fixed up by David Henningsson <david.henningsson at canonical.com>]

Reported-by: Andras Muranyi <muranyia at gmail.com>
Reference: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1381475
Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 src/modules/udev-util.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/modules/udev-util.c b/src/modules/udev-util.c
index 49fc701..d32f8d7 100644
--- a/src/modules/udev-util.c
+++ b/src/modules/udev-util.c
@@ -168,6 +168,7 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
     struct udev_device *card = NULL;
     char *t;
     const char *v;
+    const char *bus;
     int id;
 
     pa_assert(p);
@@ -201,15 +202,16 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
             pa_proplist_sets(p, "udev.id", v);
 
     if (!pa_proplist_contains(p, PA_PROP_DEVICE_BUS))
-        if ((v = udev_device_get_property_value(card, "ID_BUS")) && *v)
-            pa_proplist_sets(p, PA_PROP_DEVICE_BUS, v);
+        if ((bus = udev_device_get_property_value(card, "ID_BUS")) && *bus)
+            pa_proplist_sets(p, PA_PROP_DEVICE_BUS, bus);
 
     if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_ID))
         if ((id = read_id(card, "ID_VENDOR_ID")) > 0)
             pa_proplist_setf(p, PA_PROP_DEVICE_VENDOR_ID, "%04x", id);
 
     if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) {
-        if ((v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v)
+        /* ID_VENDOR_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */
+        if (!pa_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v)
             pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v);
         else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v)
             proplist_sets_unescape(p, PA_PROP_DEVICE_VENDOR_NAME, v);
@@ -222,7 +224,8 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
             pa_proplist_setf(p, PA_PROP_DEVICE_PRODUCT_ID, "%04x", id);
 
     if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) {
-        if ((v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v)
+        /* ID_MODEL_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */
+        if (!pa_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v)
             pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
         else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v)
             proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
-- 
1.9.1



More information about the pulseaudio-discuss mailing list