From ed4a34270a9301fa6a53d4a4f4526c4b3eead4e7 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 30 Apr 2009 12:30:57 +0300 Subject: [PATCH] obexd: Bring back tty reopen attempt on POLLHUP It turns out that to get PC Suite to work properly we need to keep the POLLHUP notifications in the kernel and have userspace retry opening the tty on such an event. This commit essentially reverts commit 50ca8715834cbcdbf15aac3abfd75d287ebacede and adapts it to the current state of obex.c (several things have changed so a clean revert isn't possible). --- obexd/src/obex.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/obexd/src/obex.c b/obexd/src/obex.c index 6380702d3..b85f05bd3 100644 --- a/obexd/src/obex.c +++ b/obexd/src/obex.c @@ -935,6 +935,17 @@ static void obex_handle_destroy(gpointer user_data) OBEX_Cleanup(obex); } +static gboolean tty_reinit(gpointer data) +{ + struct server *server = data; + + tty_init(server->services, server->folder, server->capability, server->devnode); + + server_free(server); + + return FALSE; +} + static gboolean obex_handle_input(GIOChannel *io, GIOCondition cond, gpointer user_data) { @@ -957,8 +968,13 @@ static gboolean obex_handle_input(GIOChannel *io, return TRUE; failed: - if (os->server->devnode) - tty_closed(); + if (os->server->devnode) { + if (cond & G_IO_NVAL) + tty_closed(); + else + g_idle_add(tty_reinit, os->server); + } + return FALSE; } -- 2.47.3