diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-22 17:11:10 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-22 17:11:10 +0000 |
commit | 0762886602369f99a473dc95cc288def7b6e363c (patch) | |
tree | 16420e1e3d6c823d59c1711b547025a89db7155f /input/manager.c | |
parent | 51386028973220d84b6a7e59735fa1fce98621b3 (diff) |
input: convert hidd to input
Diffstat (limited to 'input/manager.c')
-rw-r--r-- | input/manager.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/input/manager.c b/input/manager.c index 03c914ee..666c0e44 100644 --- a/input/manager.c +++ b/input/manager.c @@ -962,6 +962,34 @@ cleanup: g_free(hidp.rd_data); } +/* hidd to input transition function */ +static void stored_hidd(char *key, char *value, void *data) +{ + struct hidp_connadd_req hidp; + char *str, filename[PATH_MAX + 1], addr[18]; + bdaddr_t dst, *src = data; + + ba2str(src, addr); + create_name(filename, PATH_MAX, STORAGEDIR, addr, "input"); + + str = textfile_get(filename, key); + if (str) { + /* Skip: entry found in input file */ + free(str); + return; + } + + memset(&hidp, 0, sizeof(struct hidp_connadd_req)); + + if (parse_stored_hidd(value, &hidp) < 0) + return; + + str2ba(key, &dst); + store_device_info(src, &dst, &hidp); + if (hidp.rd_data) + g_free(hidp.rd_data); +} + static void register_stored_inputs(void) { char dirname[PATH_MAX + 1]; @@ -980,10 +1008,16 @@ static void register_stored_inputs(void) if (!isdigit(de->d_name[0])) continue; + str2ba(de->d_name, &src); + + /* move the hidd entries to the input storage */ create_name(filename, PATH_MAX, STORAGEDIR, - de->d_name, "input"); + de->d_name, "hidd"); + textfile_foreach(filename, stored_hidd, &src); - str2ba(de->d_name, &src); + /* load the input stored devices */ + create_name(filename, PATH_MAX, STORAGEDIR, + de->d_name, "input"); textfile_foreach(filename, stored_input, &src); } |