diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-11 03:22:14 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-11 03:22:14 +0000 |
commit | 130ec73e48a959f397856808fdd64d3b0084a3d2 (patch) | |
tree | d2482962f80c6924cba7353102b9b93027bc04e2 /hcid/storage.c | |
parent | d4dc948acace9ab535c78b15d3fc04b11a0e3751 (diff) |
Retrieve link key type together with the key itself
Diffstat (limited to 'hcid/storage.c')
-rw-r--r-- | hcid/storage.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hcid/storage.c b/hcid/storage.c index 4dbf8a94..595e9a22 100644 --- a/hcid/storage.c +++ b/hcid/storage.c @@ -433,7 +433,7 @@ int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) return textfile_put(filename, addr, str); } -int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, int type, int length) +int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t type, int length) { char filename[PATH_MAX + 1], addr[18], str[38]; int i; @@ -461,7 +461,7 @@ int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, int type return textfile_put(filename, addr, str); } -int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key) +int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t *type) { char filename[PATH_MAX + 1], addr[18], tmp[3], *str; int i; @@ -479,6 +479,11 @@ int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key) key[i] = (uint8_t) strtol(tmp, NULL, 16); } + if (type) { + memcpy(tmp, str + 33, 2); + *type = (uint8_t) strtol(tmp, NULL, 10); + } + free(str); return 0; |