summaryrefslogtreecommitdiffstats
path: root/hcid/storage.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-02-08 10:59:19 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-02-08 10:59:19 +0000
commitaea137795fc999ded15d260915e959285c122286 (patch)
treeaaea101206c056ba2448395c72f507bbe3af33d1 /hcid/storage.c
parent85cc0c57e4fd0e44c3b270aba4f87eb28151b1a2 (diff)
Add support for last used information
Diffstat (limited to 'hcid/storage.c')
-rw-r--r--hcid/storage.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 063b6952..a553ae96 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -137,6 +137,22 @@ int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm)
return textfile_put(filename, addr, str);
}
+int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm)
+{
+ char filename[PATH_MAX + 1], addr[18], str[24];
+
+ memset(str, 0, sizeof(str));
+ strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", tm);
+
+ ba2str(local, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/lastused", STORAGEDIR, addr);
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ ba2str(peer, addr);
+ return textfile_put(filename, addr, str);
+}
+
int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, int type)
{
char filename[PATH_MAX + 1], addr[18], str[35];