On Thu, 2005-05-12 at 16:19 +0200, Armin Bauer wrote:
>
> Nathan Hand wrote:
> > This code in irmc_bluetooth.c isn't endian safe. On a PowerPC it was
> > searching over 16 million devices on the piconet.
> >
> > 94 if (!sdp_general_inquiry(ii, 10, 10000, (uint8_t*)&numfound))
> > (gdb) next
> > ...
> > (gdb) print numfound
> > $25 = 16777216.
> >
> > The search effectively never finishes and the list remains empty.
> >
> > Simple patch fixes the problem. Search now correctly detects my Sony
> > T360 using LinuxPPC. Syncing with Evolution works beaut.
> >
>
> Thanks for your patch!
>
> > One last point, after adding the patch I notice that numfound is not
> > equal to 1 but is equal to '1' (aka 0x31).
> >
> > (gdb) print numfound
> > $1 = 49 '1'
> >
> > Maybe that's a libbluetooth bug? Anyway, doesn't hurt, it takes mere
> > seconds to scan through 48 non-existent devices.
> >
>
> Maybe it just always returns the result of this inquiry as a string so
> we should do a atoi to get the correct integer... i think we should
> check this before commiting the patch since i would consider 48 false
> scans a pretty bad bug.
Here's the code for sdp_general_inquiry
int sdp_general_inquiry(inquiry_info *ii, int num_dev,
int duration, uint8_t *found)
{
int n = hci_inquiry(-1, 10, num_dev, NULL, &ii, 0);
if (n < 0) {
SDPERR("Inquiry failed:%s", strerror(errno));
return -1;
}
*found = n;
return 0;
}
That's definitely not a string; not null terminated and cast from an
integer. Looking at the hci_inquiry code, the return value is an error
code if negative or the number of devices if positive. No string.
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Multisync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/multisync-devel