summaryrefslogtreecommitdiffstats
path: root/input/server.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-01-25 14:25:07 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-01-25 14:25:07 +0000
commitd0dc2769f9f1e9cd3ef3b430d7eff0d5d90a7e6b (patch)
tree3719e29b34e57b354bf9dad21e57ea752047d43b /input/server.c
parent548af209820a7fce360f852db81ac38807c3aa3b (diff)
Moved HID store related functions to a new file
Diffstat (limited to 'input/server.c')
-rw-r--r--input/server.c55
1 files changed, 2 insertions, 53 deletions
diff --git a/input/server.c b/input/server.c
index b37c35ff..9e97490f 100644
--- a/input/server.c
+++ b/input/server.c
@@ -38,8 +38,9 @@
#include <glib.h>
#include "logging.h"
-#include "textfile.h"
+
#include "server.h"
+#include "storage.h"
struct session_data {
bdaddr_t src;
@@ -72,58 +73,6 @@ static gboolean session_event(GIOChannel *chan, GIOCondition cond, gpointer data
return TRUE;
}
-static int get_stored_device_info(const bdaddr_t *src, const bdaddr_t *dst,
- struct hidp_connadd_req *req)
-{
- char filename[PATH_MAX + 1], addr[18], tmp[3], *str, *desc;
- unsigned int vendor, product, version, subclass, country, parser, pos;
- int i;
-
- desc = malloc(4096);
- if (!desc)
- return -ENOMEM;
-
- memset(desc, 0, 4096);
-
- ba2str(src, addr);
- create_name(filename, PATH_MAX, STORAGEDIR, addr, "hidd");
-
- ba2str(dst, addr);
- str = textfile_get(filename, addr);
- if (!str) {
- free(desc);
- return -EIO;
- }
-
- sscanf(str, "%04X:%04X:%04X %02X %02X %04X %4095s %08X %n",
- &vendor, &product, &version, &subclass, &country,
- &parser, desc, &req->flags, &pos);
-
- free(str);
-
- req->vendor = vendor;
- req->product = product;
- req->version = version;
- req->subclass = subclass;
- req->country = country;
- req->parser = parser;
-
- snprintf(req->name, 128, str + pos);
-
- req->rd_size = strlen(desc) / 2;
- req->rd_data = malloc(req->rd_size);
- if (!req->rd_data)
- return -ENOMEM;
-
- memset(tmp, 0, sizeof(tmp));
- for (i = 0; i < req->rd_size; i++) {
- memcpy(tmp, desc + (i * 2), 2);
- req->rd_data[i] = (uint8_t) strtol(tmp, NULL, 16);
- }
-
- return 0;
-}
-
static void create_device(struct session_data *session)
{
struct hidp_connadd_req req;