summaryrefslogtreecommitdiffstats
path: root/hcid/storage.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-10-02 12:03:39 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-10-02 12:03:39 +0000
commit07021baf7a9e81f75776c99d65b774204b11422e (patch)
treed9c5c5136c82bf3a95c57be30fbdd8821bfa357b /hcid/storage.c
parentecb771f7006daf7bdb2c32ac01c435d97cb5bd9d (diff)
Implement support for SetMode("on")
Diffstat (limited to 'hcid/storage.c')
-rw-r--r--hcid/storage.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 68f3470c..f2254cc3 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -94,6 +94,9 @@ int write_device_mode(bdaddr_t *bdaddr, const char *mode)
create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (strcmp(mode, "off") != 0)
+ textfile_put(filename, "on", mode);
+
return textfile_put(filename, "mode", mode);
}
@@ -115,6 +118,24 @@ int read_device_mode(bdaddr_t *bdaddr, char *mode, int length)
return 0;
}
+int read_on_mode(bdaddr_t *bdaddr, char *mode, int length)
+{
+ char filename[PATH_MAX + 1], *str;
+
+ create_filename(filename, PATH_MAX, bdaddr, "config");
+
+ str = textfile_get(filename, "on");
+ if (!str)
+ return -ENOENT;
+
+ strncpy(mode, str, length);
+ mode[length - 1] = '\0';
+
+ free(str);
+
+ return 0;
+}
+
int write_local_name(bdaddr_t *bdaddr, char *name)
{
char filename[PATH_MAX + 1], str[249];