* How to past connect complete event status (page timeout) to apps
@ 2010-07-23 17:48 Ed Tsang
2010-07-23 20:15 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: Ed Tsang @ 2010-07-23 17:48 UTC (permalink / raw)
To: Bluettooth Linux
Hi, I tried to implement my apps to do different things depend on the failed
connection attempt.
On Hci dump I could saw the connect complete status is different depend on the
actual failure (e.g. 0x10 accept timeout, 0x06, PIN missing, 0x04 page
timeout). But the apps (base on obex-client) is not able to see those status
code.
The obex-client attempt a sdp_connect and then g_io_add_watch. On the
callback, we could see the G_IO_ERROR but I could not figure out a way to get
more detail on the failed condition. I tried look into the Bluez and could not
figure what to change to pass those connect event status up..
Anyone could offer some advise/hint...
Cheers,
Ed
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: How to past connect complete event status (page timeout) to apps 2010-07-23 17:48 How to past connect complete event status (page timeout) to apps Ed Tsang @ 2010-07-23 20:15 ` Luiz Augusto von Dentz 2010-07-28 14:04 ` Ed Tsang 0 siblings, 1 reply; 3+ messages in thread From: Luiz Augusto von Dentz @ 2010-07-23 20:15 UTC (permalink / raw) To: Ed Tsang; +Cc: Bluettooth Linux Hi, On Fri, Jul 23, 2010 at 8:48 PM, Ed Tsang <netdesign_98@yahoo.com> wrote: > Hi, I tried to implement my apps to do different things depend on the failed > connection attempt. > On Hci dump I could saw the connect complete status is different depend on the > actual failure (e.g. 0x10 accept timeout, 0x06, PIN missing, 0x04 page > timeout). But the apps (base on obex-client) is not able to see those status > code. > The obex-client attempt a sdp_connect and then g_io_add_watch. On the > callback, we could see the G_IO_ERROR but I could not figure out a way to get > more detail on the failed condition. I tried look into the Bluez and could not > figure what to change to pass those connect event status up.. > Anyone could offer some advise/hint... Well first you will not get the same error on the socket, they will be translated to errno but the errors will be very similar e.g: page timeout is mapped to EHOSTDOWN. But it seems we have a bug in obex-client, basically we need to check SO_ERROR with getsockopt before proceeding with sdp_set_notify. If you are fixing this please have a look at btio.c, it should be ok and it seems ofono does it in a similar fashion: /* If the user aborted this connect attempt */ if ((cond & G_IO_NVAL) || check_nval(io)) return FALSE; if (cond & G_IO_OUT) { int err = 0, sock = g_io_channel_unix_get_fd(io); socklen_t len = sizeof(err); if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &len) < 0) err = errno; if (err) g_set_error(&gerr, BT_IO_ERROR, BT_IO_ERROR_CONNECT_FAILED, "%s (%d)", strerror(err), err); } else if (cond & (G_IO_HUP | G_IO_ERR)) g_set_error(&gerr, BT_IO_ERROR, BT_IO_ERROR_CONNECT_FAILED, "HUP or ERR on socket"); -- Luiz Augusto von Dentz Computer Engineer ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to past connect complete event status (page timeout) to apps 2010-07-23 20:15 ` Luiz Augusto von Dentz @ 2010-07-28 14:04 ` Ed Tsang 0 siblings, 0 replies; 3+ messages in thread From: Ed Tsang @ 2010-07-28 14:04 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: Bluettooth Linux Luiz, Got it working now EHOSTDOWN, ETIMEOUT... I could not fix the git, as my private branch out of 0.14. What I did is inject at some of the call back (service_callback, rfcomm_callback..). if (cond & (G_IO_NVAL | G_IO_ERR)) { int err = 0, sock = g_io_channel_unix_get_fd(io); socklen_t len = sizeof(err); if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &len) < 0) err = errno; /* then send it to the agent via a new method*/ } -------- Basically I will see G_IO_ERR when it fail (for those test case that I am working on). One question that I hope you could help me is to how to tune the timing for ETIMEOUT, GW_OBEX_ERROR_TIMEOUT. I tried to search (timeout|TIMEOUT) and did not get too far. Cheers Ed ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-28 14:04 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-07-23 17:48 How to past connect complete event status (page timeout) to apps Ed Tsang 2010-07-23 20:15 ` Luiz Augusto von Dentz 2010-07-28 14:04 ` Ed Tsang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox