mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
udev: use ID_MODEL/ID_VENDOR to give friendly name for FireWire devices
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@canonical.com>] Reported-by: Andras Muranyi <muranyia@gmail.com> Reference: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1381475 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
ef864eeab0
commit
3ac73598c6
1 changed files with 7 additions and 4 deletions
|
|
@ -168,6 +168,7 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
|
||||||
struct udev_device *card = NULL;
|
struct udev_device *card = NULL;
|
||||||
char *t;
|
char *t;
|
||||||
const char *v;
|
const char *v;
|
||||||
|
const char *bus;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
pa_assert(p);
|
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);
|
pa_proplist_sets(p, "udev.id", v);
|
||||||
|
|
||||||
if (!pa_proplist_contains(p, PA_PROP_DEVICE_BUS))
|
if (!pa_proplist_contains(p, PA_PROP_DEVICE_BUS))
|
||||||
if ((v = udev_device_get_property_value(card, "ID_BUS")) && *v)
|
if ((bus = udev_device_get_property_value(card, "ID_BUS")) && *bus)
|
||||||
pa_proplist_sets(p, PA_PROP_DEVICE_BUS, v);
|
pa_proplist_sets(p, PA_PROP_DEVICE_BUS, bus);
|
||||||
|
|
||||||
if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_ID))
|
if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_ID))
|
||||||
if ((id = read_id(card, "ID_VENDOR_ID")) > 0)
|
if ((id = read_id(card, "ID_VENDOR_ID")) > 0)
|
||||||
pa_proplist_setf(p, PA_PROP_DEVICE_VENDOR_ID, "%04x", id);
|
pa_proplist_setf(p, PA_PROP_DEVICE_VENDOR_ID, "%04x", id);
|
||||||
|
|
||||||
if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) {
|
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);
|
pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v);
|
||||||
else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v)
|
else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v)
|
||||||
proplist_sets_unescape(p, PA_PROP_DEVICE_VENDOR_NAME, 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);
|
pa_proplist_setf(p, PA_PROP_DEVICE_PRODUCT_ID, "%04x", id);
|
||||||
|
|
||||||
if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) {
|
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);
|
pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
|
||||||
else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v)
|
else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v)
|
||||||
proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
|
proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue