diff options
author | João Paulo Rechi Vita <jprvita@openbossa.org> | 2013-04-22 19:44:59 -0300 |
---|---|---|
committer | João Paulo Rechi Vita <jprvita@openbossa.org> | 2013-04-23 14:43:16 -0300 |
commit | a26fcb8c3dd08e3f873aed4f94ae7eeeeae6382a (patch) | |
tree | 5a5591a5b6e864655d9e201b022a7bbfddb273b2 | |
parent | bed2b5a5271245d1a5c97ed35386846eae5ab631 (diff) |
bluetooth: Use 'Alias' instead of 'Name'HFP-OFONO-NO-SPLIT
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.
-rw-r--r-- | src/modules/bluetooth/bluetooth-util.c | 9 | ||||
-rw-r--r-- | src/modules/bluetooth/bluetooth-util.h | 1 | ||||
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 4 |
3 files changed, 4 insertions, 10 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 211b4ffa..3165ed8a 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -286,7 +286,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; @@ -335,7 +334,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); @@ -469,10 +467,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")) { @@ -1017,7 +1012,7 @@ static int parse_device_properties(pa_bluetooth_device *d, DBusMessageIter *i, b dbus_message_iter_next(&element_i); } - if (!d->name || !d->address || !d->alias || d->paired < 0 || d->trusted < 0) { + if (!d->address || !d->alias || d->paired < 0 || d->trusted < 0) { pa_log_error("Non-optional information missing for device %s", d->path); d->device_info_valid = -1; return -1; diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h index b33e97f9..cf97e065 100644 --- a/src/modules/bluetooth/bluetooth-util.h +++ b/src/modules/bluetooth/bluetooth-util.h @@ -129,7 +129,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 f418cc9b..2689d4f7 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2610,7 +2610,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); @@ -2623,7 +2623,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; |