diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-02-24 18:12:08 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-02-24 18:12:08 +0000 |
commit | d2bc437c04a2048856ba3edc54b9553bfdbd6e55 (patch) | |
tree | 1a36ade3bf7263246f7a43478c7056e8266f0a07 /hcid/main.c | |
parent | b0fc2dd356f7f5e1bceb3d901058bcd9e2bc5535 (diff) |
Store the changed name of a local device
Diffstat (limited to 'hcid/main.c')
-rw-r--r-- | hcid/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/hcid/main.c b/hcid/main.c index 30266ff7..c8ae1e34 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -219,10 +219,19 @@ static void configure_device(int hdev) if ((device_opts->flags & (1 << HCID_SET_NAME)) && device_opts->name) { change_local_name_cp cp; write_ext_inquiry_response_cp ip; + bdaddr_t bdaddr; + char name[249]; uint8_t len; - memset(cp.name, 0, sizeof(cp.name)); - expand_name((char *) cp.name, sizeof(cp.name), device_opts->name, hdev); + hci_devba(hdev, &bdaddr); + + memset(name, 0, sizeof(name)); + if (read_local_name(&bdaddr, name) < 0) { + memset(cp.name, 0, sizeof(cp.name)); + expand_name((char *) cp.name, sizeof(cp.name), + device_opts->name, hdev); + } else + memcpy(cp.name, name, sizeof(cp.name)); ip.fec = 0x00; memset(ip.data, 0, sizeof(ip.data)); |