From: Jo?o Paulo Rechi Vita <jprvita@xxxxxxxxxxxxx> According to the BlueZ API documentation the 'Alias' property should be preffered over the 'Name' property. Also, if the device doesn't have a remote name the 'Name' property may not be set, but the 'Alias' property will always be. --- src/modules/bluetooth/bluetooth-util.c | 7 +------ src/modules/bluetooth/bluetooth-util.h | 1 - src/modules/bluetooth/module-bluetooth-device.c | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index c15ecd1..b0ee62c 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -179,7 +179,6 @@ static pa_bluetooth_device* device_new(pa_bluetooth_discovery *discovery, const d->device_info_valid = 0; - d->name = NULL; d->path = pa_xstrdup(path); d->paired = -1; d->alias = NULL; @@ -228,7 +227,6 @@ static void device_free(pa_bluetooth_device *d) { uuid_free(u); } - pa_xfree(d->name); pa_xfree(d->path); pa_xfree(d->alias); pa_xfree(d->address); @@ -364,10 +362,7 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo const char *value; dbus_message_iter_get_basic(&variant_i, &value); - if (pa_streq(key, "Name")) { - pa_xfree(d->name); - d->name = pa_xstrdup(value); - } else if (pa_streq(key, "Alias")) { + if (pa_streq(key, "Alias")) { pa_xfree(d->alias); d->alias = pa_xstrdup(value); } else if (pa_streq(key, "Address")) { diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h index 3361b0f..1040d5b 100644 --- a/src/modules/bluetooth/bluetooth-util.h +++ b/src/modules/bluetooth/bluetooth-util.h @@ -120,7 +120,6 @@ struct pa_bluetooth_device { int device_info_valid; /* 0: no results yet; 1: good results; -1: bad results ... */ /* Device information */ - char *name; char *path; pa_bluetooth_transport *transports[PA_BLUETOOTH_PROFILE_COUNT]; int paired; diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index cd0a515..ddf658f 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2237,7 +2237,7 @@ static int add_card(struct userdata *u) { data.driver = __FILE__; data.module = u->module; - n = pa_bluetooth_cleanup_name(device->name); + n = pa_bluetooth_cleanup_name(device->alias); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, n); pa_xfree(n); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, device->address); @@ -2250,7 +2250,7 @@ static int add_card(struct userdata *u) { pa_proplist_sets(data.proplist, "bluez.path", device->path); pa_proplist_setf(data.proplist, "bluez.class", "0x%06x", (unsigned) device->class); - pa_proplist_sets(data.proplist, "bluez.name", device->name); + pa_proplist_sets(data.proplist, "bluez.name", device->alias); data.name = get_name("card", u->modargs, device->address, &b); data.namereg_fail = b; -- 1.7.11.7