mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 16:54:38 +08:00
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:
parent
f791c862d8
commit
a4b1673b87
33
compat/sdp.c
33
compat/sdp.c
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user