[Bluez-devel] [PATCH]Re: multithreaded name resolution

Andreas Gaufer
2007-10-01T13:40:23Z

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

On Fri, 24 Aug 2007 14:14:53 +0200 (CEST)
Peter Wippich <pewi@gw-instruments.de> wrote:

>
> Hi Matthias,
>
> On Fri, 24 Aug 2007, Matthias Becker wrote:
>
> > Hi,
> >
> > I tried to read the name of different devices parallel using multi
> > threading, but without success. If there is one bluetooth device I works
> > (as there is no real multi threading). If there are who devices, the
> > same name is reported for both devices. In another test with 6 devices
> > hci_read_remote_name returned something <0 so I did not get any name at
> > all.
>
> this won't work. Asking for the name of a device is some sort of
> connection setup, and most (all ?) Bt chips do not allow / can not handle
> parallel connection setups (even though parallel connections are
> possible).
>
> So don't try further, the problem is outside your code (and even BlueZ).
>

That's not true, the reported behavior is produced by bluez-libs. I already
sent a patch to fix it and will attach that patch again to this mail.

Please let me know if that Patch fixes your problem Matthias.

Greetings

Andy

See also:
http://thread.gmane.org/gmane.linux.bluez.devel/12491

[-- Attachment #2: bluez-libs-3.19-EVT_REMOTE_NAME_REQ_COMPLETE.patch --]
[-- Type: application/octet-stream, Size: 797 bytes --]

diff -ur bluez-libs-3.19-ORG/src/hci.c bluez-libs-3.19/src/hci.c
--- bluez-libs-3.19-ORG/src/hci.c 2007-10-01 11:06:18.013479576 +0200
+++ bluez-libs-3.19/src/hci.c 2007-10-01 15:19:36.301988528 +0200
@@ -1010,6 +1010,8 @@
while (try--) {
evt_cmd_complete *cc;
evt_cmd_status *cs;
+ evt_remote_name_req_complete *rn;
+ remote_name_req_cp *cp;

if (to) {
struct pollfd p;
@@ -1074,6 +1076,21 @@
memcpy(r->rparam, ptr, r->rlen);
goto done;

+ case EVT_REMOTE_NAME_REQ_COMPLETE:
+
+ if (hdr->evt != r->event)
+ break;
+
+ r->rlen = MIN(len, r->rlen);
+ memcpy(r->rparam, ptr, r->rlen);
+
+ rn = r->rparam;
+ cp = r->cparam;
+
+ if (bacmp(&rn->bdaddr,&cp->bdaddr) == 0)
+ goto done;
+ continue;
+
default:
if (hdr->evt != r->event)
break;

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]