summaryrefslogtreecommitdiffstats
path: root/serial/port.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-18 15:16:21 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-18 15:16:21 +0000
commitf7544168a7628f67f98da7a7d6db63678a3d9be3 (patch)
tree8d4db6fdd22d6649252bd4c6e58baae01bbc2f1a /serial/port.c
parentd0b45fbc214a16bcc0b13f4e37c37a8bfa96b904 (diff)
serial: keep port_open static since Connect will not be implemented
Diffstat (limited to 'serial/port.c')
-rw-r--r--serial/port.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/serial/port.c b/serial/port.c
index 3866076a..3c6980ce 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -50,10 +50,6 @@
#define SERIAL_PORT_INTERFACE "org.bluez.serial.Port"
-/* Waiting for udev to create the device node */
-#define MAX_OPEN_TRIES 5
-#define OPEN_WAIT 300 /* ms */
-
struct rfcomm_node {
int16_t id; /* RFCOMM device id */
bdaddr_t dst; /* Destination address */
@@ -64,14 +60,6 @@ struct rfcomm_node {
guint io_id; /* IO Channel ID */
};
-struct open_context {
- char *dev;
- open_notify_t notify;
- udata_free_t ufree;
- void *udata;
- int ntries;
-};
-
static GSList *connected_nodes = NULL;
static GSList *bound_nodes = NULL;
@@ -315,54 +303,3 @@ int port_unregister(const char *path)
return 0;
}
-
-static gboolean open_continue(struct open_context *oc)
-{
- int fd;
-
- fd = open(oc->dev, O_RDONLY | O_NOCTTY);
- if (fd < 0) {
- int err = errno;
- error("Could not open %s: %s (%d)",
- oc->dev, strerror(err), err);
- if (++oc->ntries >= MAX_OPEN_TRIES) {
- /* Reporting error */
- oc->notify(fd, err, oc->udata);
- return FALSE;
- }
- return TRUE;
- }
- /* Connection succeeded */
- oc->notify(fd, 0, oc->udata);
- return FALSE;
-}
-
-static void open_context_free(void *data)
-{
- struct open_context *oc = data;
-
- if (oc->ufree)
- oc->ufree(oc->udata);
- g_free(oc->dev);
- g_free(oc);
-}
-
-int port_open(const char *dev, open_notify_t notify, void *udata, udata_free_t ufree)
-{
- int fd;
-
- fd = open(dev, O_RDONLY | O_NOCTTY);
- if (fd < 0) {
- struct open_context *oc;
- oc = g_new0(struct open_context, 1);
- oc->dev = g_strdup(dev);
- oc->notify = notify;
- oc->ufree = ufree;
- oc->udata = udata;
- g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, OPEN_WAIT,
- (GSourceFunc) open_continue, oc, open_context_free);
- return -EINPROGRESS;
- }
-
- return fd;
-}