diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-04-25 18:59:55 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-04-25 18:59:55 +0000 |
commit | eefb64d927b48d2de2e100b1f7ee715bf86bbb57 (patch) | |
tree | b554c892901c0010969e21b14198cc77a6a0c78a /sdpd/server.c | |
parent | 748b15f0a5eb6c1078a4dff64604f042c48a7a4a (diff) |
Add device ID support
Diffstat (limited to 'sdpd/server.c')
-rw-r--r-- | sdpd/server.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sdpd/server.c b/sdpd/server.c index 2abcc6bc..fab17f00 100644 --- a/sdpd/server.c +++ b/sdpd/server.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <errno.h> #include <unistd.h> +#include <stdlib.h> #include <sys/stat.h> #include <sys/socket.h> @@ -215,7 +216,7 @@ static gboolean io_accept_event(GIOChannel *chan, GIOCondition cond, gpointer da return TRUE; } -int start_sdp_server(uint16_t mtu, uint32_t flags) +int start_sdp_server(uint16_t mtu, const char *did, uint32_t flags) { int compat = flags & SDP_SERVER_COMPAT; int master = flags & SDP_SERVER_MASTER; @@ -228,6 +229,21 @@ int start_sdp_server(uint16_t mtu, uint32_t flags) return -1; } + if (did && strlen(did) > 0) { + const char *ptr = did; + uint16_t vid = 0x0000, pid = 0x0000, ver = 0x0000; + + vid = (uint16_t) strtol(ptr, NULL, 16); + ptr = strchr(ptr, ':'); + if (ptr) { + pid = (uint16_t) strtol(ptr + 1, NULL, 16); + ptr = strchr(ptr + 1, ':'); + if (ptr) + ver = (uint16_t) strtol(ptr + 1, NULL, 16); + register_device_id(vid, pid, ver); + } + } + l2cap_io = g_io_channel_unix_new(l2cap_sock); g_io_channel_set_close_on_unref(l2cap_io, TRUE); |