summaryrefslogtreecommitdiffstats
path: root/serial
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-15 20:51:30 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-15 20:51:30 +0000
commitfb2bb3f2dcc78b19fb77d9bebf71021c54704e96 (patch)
treee9a94ba5f0159a633deda289052646ed1abc7a63 /serial
parent97650b3f8187b0f8cf8d6f3dfa1c3d6752ef5ca2 (diff)
serial: only use automatic assigned channels when it is not provided by the user
Diffstat (limited to 'serial')
-rw-r--r--serial/manager.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/serial/manager.c b/serial/manager.c
index f9532ff6..4dd98469 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -935,7 +935,7 @@ static int rfcomm_listen(bdaddr_t *src, uint8_t *channel, int opts)
memset(&laddr, 0, sizeof(laddr));
laddr.rc_family = AF_BLUETOOTH;
bacpy(&laddr.rc_bdaddr, src);
- laddr.rc_channel = 0;
+ laddr.rc_channel = (channel ? *channel : 0);
alen = sizeof(laddr);
if (bind(sk, (struct sockaddr *) &laddr, alen) < 0)
@@ -944,6 +944,9 @@ static int rfcomm_listen(bdaddr_t *src, uint8_t *channel, int opts)
if (listen(sk, 1) < 0)
goto fail;
+ if (!channel)
+ return sk;
+
memset(&laddr, 0, sizeof(laddr));
if (getsockname(sk, (struct sockaddr *)&laddr, &alen) < 0)
goto fail;
@@ -1233,7 +1236,7 @@ static DBusHandlerResult proxy_enable(DBusConnection *conn,
return err_failed(conn, msg, "Already enabled");
/* Listen */
- /* FIXME: missing options */
+ /* FIXME: missing options, update the stored channel */
sk = rfcomm_listen(&prx->src, &prx->channel, 0);
if (sk < 0) {
const char *strerr = strerror(errno);