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; rec = (sdp_record_t *) hid_rsp->data;
pdlist = sdp_data_get(rec, 0x0101); pdlist2 = sdp_data_get(rec, 0x0100);
pdlist2 = sdp_data_get(rec, 0x0102); if (pdlist2)
if (pdlist) { strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
if (pdlist2) { else {
if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) { pdlist = sdp_data_get(rec, 0x0101);
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1); pdlist2 = sdp_data_get(rec, 0x0102);
strcat(req->name, " "); if (pdlist) {
} if (pdlist2) {
strncat(req->name, pdlist->val.str, if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
sizeof(req->name) - strlen(req->name)); strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
} else strcat(req->name, " ");
strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1); }
} else { strncat(req->name, pdlist->val.str,
pdlist2 = sdp_data_get(rec, 0x0100); sizeof(req->name) - strlen(req->name));
if (pdlist2) } else
strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1); strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
}
} }
pdlist = sdp_data_get(rec, 0x0201); pdlist = sdp_data_get(rec, 0x0201);