summaryrefslogtreecommitdiffstats
path: root/hcid/storage.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-02-24 18:40:27 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-02-24 18:40:27 +0000
commit12100721445e1651a5b8d58f4b5c8190de8d517e (patch)
tree5bbd8679e84694b51c619c74c061e66262ef01d6 /hcid/storage.c
parentd2bc437c04a2048856ba3edc54b9553bfdbd6e55 (diff)
Store the minor class changes
Diffstat (limited to 'hcid/storage.c')
-rw-r--r--hcid/storage.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 48b040cf..0fae9447 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -85,6 +85,36 @@ int read_local_name(bdaddr_t *bdaddr, char *name)
return 0;
}
+int write_local_class(bdaddr_t *bdaddr, uint8_t *class)
+{
+ char filename[PATH_MAX + 1], addr[18], str[9];
+
+ sprintf(str, "0x%2.2x%2.2x%2.2x", class[2], class[1], class[0]);
+
+ ba2str(bdaddr, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/config", STORAGEDIR, addr);
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ return textfile_put(filename, "class", str);
+}
+
+int read_local_class(bdaddr_t *bdaddr, uint8_t *class)
+{
+ char filename[PATH_MAX + 1], addr[18], *str;
+
+ ba2str(bdaddr, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/config", STORAGEDIR, addr);
+
+ str = textfile_get(filename, "class");
+ if (!str)
+ return -ENOENT;
+
+ free(str);
+
+ return 0;
+}
+
int write_device_name(bdaddr_t *local, bdaddr_t *peer, char *name)
{
char filename[PATH_MAX + 1], addr[18], str[249];