diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-09-20 16:18:31 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-09-20 16:18:31 +0000 |
commit | abe03b24985eef4659c9d058c354f9b7df0a41f0 (patch) | |
tree | 7dad097cc2d42a59771adbf0a86abc7ecbc20190 /hcid | |
parent | ffee48e182962699136a618c9fba5961718de0e1 (diff) |
Set name field for extended inquiry response
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/device.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/hcid/device.c b/hcid/device.c index f92fa0c7..71af2d59 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -438,10 +438,13 @@ int get_device_name(uint16_t dev_id, char *name, size_t size) int set_device_name(uint16_t dev_id, const char *name) { + struct hci_dev *dev; int dd; ASSERT_DEV_ID; + dev = &devices[dev_id]; + dd = hci_open_dev(dev_id); if (dd < 0) { error("Can't open device hci%d", @@ -457,6 +460,29 @@ int set_device_name(uint16_t dev_id, const char *name) return -err; } + if (dev->features[6] & LMP_EXT_INQ) { + uint8_t fec = 0, data[240]; + int len; + + memset(data, 0, sizeof(data)); + len = strlen(name); + if (len > 48) { + len = 48; + data[1] = 0x08; + } else + data[1] = 0x09; + data[0] = len + 1; + memcpy(data + 2, name, len); + + if (hci_write_ext_inquiry_response(dd, fec, data, 2000) < 0) { + int err = errno; + error("Can't write extended inquiry response for hci%d: %s (%d)", + dev_id, strerror(errno), errno); + hci_close_dev(dd); + return -err; + } + } + hci_close_dev(dd); return 0; |