Fix hidd to use ServiceName attribute for device name

This patch lets hidd use ServiceName attribute from the SDP response
instead of ProviderName+ServiceDescription for device name.
SDP response from Microsoft Bluetooth device has extended ASCII
character 174(registered symbol) in its ServiceDescription attribute.
This causes some Bluetooth application which expects only printable
characters as device name to crash.
This commit is contained in:
Balamurugan Mahalingam 2010-10-20 15:51:17 +05:30 committed by Johan Hedberg
parent f791c862d8
commit a4b1673b87

View File

@ -248,22 +248,23 @@ int get_sdp_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp_co
rec = (sdp_record_t *) hid_rsp->data;
pdlist = sdp_data_get(rec, 0x0101);
pdlist2 = sdp_data_get(rec, 0x0102);
if (pdlist) {
if (pdlist2) {
if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
strcat(req->name, " ");
}
strncat(req->name, pdlist->val.str,
sizeof(req->name) - strlen(req->name));
} else
strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
} else {
pdlist2 = sdp_data_get(rec, 0x0100);
if (pdlist2)
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
pdlist2 = sdp_data_get(rec, 0x0100);
if (pdlist2)
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
else {
pdlist = sdp_data_get(rec, 0x0101);
pdlist2 = sdp_data_get(rec, 0x0102);
if (pdlist) {
if (pdlist2) {
if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
strcat(req->name, " ");
}
strncat(req->name, pdlist->val.str,
sizeof(req->name) - strlen(req->name));
} else
strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
}
}
pdlist = sdp_data_get(rec, 0x0201);