Skip to contentSkip to conversation

hci inquiry error with name scan

Bluez-devel Avaited 2 participants 3 messages Dec 26, 2006 – Jun 4, 2007 Bluetooth drivers

lore
Share & tools
lore

Avaited

author
#0 lore raw

hi all

I am facing a big problem with hci layer process. I have developed a platform and http wraper for bluetooth services using bluez. I am searching all device present in vicinity by using hci.c function 'hci_scan()'. later for each number(BDADDR) i am searching its name by hci_read_remote_name(). Most of the time I am getting right name(i.e. what ever name i am giving to my devices ) But some time name get swaped with some one. Lisk in my case my mobile name was SHARK and my Machine name was VIKAS [0], VIKAS[1], my friends mobile was GOLD, SILVER. but when I had done scan name it returned me my mobile,s name as VIKAS[1]. I am surprise why this happened.

Is there any problem with present bluez stack I am using bluez-bluefw-1.0-6
bluez-pin-0.23-3
bluez-hcidump-1.11-1
bluez-libs-2.10-2
bluez-utils-2.10-2.1
on redhat 4.0 Enterprise Edition
with kernel 2.6.9-5.EL i386
int getScanName(bdaddr_t *device_bt,char * device_name,bdaddr_t *dongle_bt)

{
        if((s = GetScanSock(dongle_bt)) < 0)    // this will connect to local dongle
        {
                ERR_LOG(ERR,"Unable to open socket");
                return -s;
        }
        if(hci_read_remote_name(s, device_bt,sizeof(device_name),device_name,0) < 0)
        {
                ERR_LOG(DBG,"No Name found");
                close(s);
                return -NOTFOUND;
        }
        ERR_LOG(DBG,"Name of Device hci scan  [%s] DeviceBT
[%s]",device_name,device_bt);
        close(s);
        return 0;
}

this function get called for each device found in scan.

I am in deep trouble to know what is problem with this.

Please help

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Hi Avaited,

i believe this is a bug in hci.c in the bluez-libs package. It returns wrong names if multiple hci_read_remote_name calls are done in a short period of time.

hci_send_req which is used by hci_read_remote_name returns data of the first EVT_REMOTE_NAME_REQ_COMPLETE that occurs on the device even if it does not match the bdaddres that was requested.

This problem was also already noticed by Sjoerd Simons in June 2004 and sent to this list with the subject "btaddr <-> name bug ?" (1)

I prepared a patch that should fix that problem. I will provide that patch on this list as soon as I'm finished with stress-testing it.

Greetings

Andy

1) http://thread.gmane.org/gmane.linux.bluez.devel/2489/focus=2491

Quoted 46 lines · On Tue, 26 Dec 2006 04:47:47 +0000 (UTC) Avaited <[email protected]> wrote:

hi all

I am facing a big problem with hci layer process. I have developed a platform and http wraper for bluetooth services using bluez. I am searching all device present in vicinity by using hci.c function 'hci_scan()'. later for each number(BDADDR) i am searching its name by hci_read_remote_name(). Most of the time I am getting right name(i.e. what ever name i am giving to my devices ) But some time name get swaped with some one. Lisk in my case my mobile name was SHARK and my Machine name was VIKAS [0], VIKAS[1], my friends mobile was GOLD, SILVER. but when I had done scan name it returned me my mobile,s name as VIKAS[1]. I am surprise why this happened.

Is there any problem with present bluez stack I am using bluez-bluefw-1.0-6
bluez-pin-0.23-3
bluez-hcidump-1.11-1
bluez-libs-2.10-2
bluez-utils-2.10-2.1
on redhat 4.0 Enterprise Edition
with kernel 2.6.9-5.EL i386
int getScanName(bdaddr_t *device_bt,char * device_name,bdaddr_t *dongle_bt)

{
        if((s = GetScanSock(dongle_bt)) < 0)    // this will connect to local dongle
        {
                ERR_LOG(ERR,"Unable to open socket");
                return -s;
        }
        if(hci_read_remote_name(s, device_bt,sizeof(device_name),device_name,0) < 0)
        {
                ERR_LOG(DBG,"No Name found");
                close(s);
                return -NOTFOUND;
        }
        ERR_LOG(DBG,"Name of Device hci scan  [%s] DeviceBT
[%s]",device_name,device_bt);
        close(s);
        return 0;
}

this function get called for each device found in scan.

I am in deep trouble to know what is problem with this.

Please help

Quoted 9 lines

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Thanks Andreas,
I am waiting for ur patch. If there anything I can do please tell me. I took other way to overcome this problem. I have allocated MAX space for array of inquery structure (i.e. 256) and then doing inquiry and making it memset zero after using its result. I think ur right .

Quoted 109 lines · Andreas Gaufer

Hi Avaited,

i believe this is a bug in hci.c in the bluez-libs package. It returns wrong names if multiple hci_read_remote_name calls are done in a short period of time.

hci_send_req which is used by hci_read_remote_name returns data of the first EVT_REMOTE_NAME_REQ_COMPLETE that occurs on the device even if it does not match the bdaddres that was requested.

This problem was also already noticed by Sjoerd Simons in June 2004 and sent to this list with the subject "btaddr <-> name bug ?" (1)

I prepared a patch that should fix that problem. I will provide that patch on this list as soon as I'm finished with stress-testing it.

Greetings

Andy

1) http://thread.gmane.org/gmane.linux.bluez.devel/2489/focus=2491

Quoted 3 lines · On Tue, 26 Dec 2006 04:47:47 +0000 (UTC) Avaited <[email protected]> wrote:

hi all

I am facing a big problem with hci layer process. I have developed a

platform

Quoted 1 line

and http wraper for bluetooth services using bluez. I am searching all

device

Quoted 2 lines

present in vicinity by using hci.c function 'hci_scan()'. later for each number(BDADDR) i am searching its name by hci_read_remote_name(). Most

of the

Quoted 1 line

time I am getting right name(i.e. what ever name i am giving to my

devices ) But

Quoted 1 line

some time name get swaped with some one. Lisk in my case my mobile name

was

Quoted 1 line

SHARK and my Machine name was VIKAS [0], VIKAS[1], my friends mobile was

GOLD,

Quoted 12 lines

SILVER. but when I had done scan name it returned me my mobile,s name as VIKAS[1]. I am surprise why this happened.

Is there any problem with present bluez stack I am using bluez-bluefw-1.0-6
bluez-pin-0.23-3
bluez-hcidump-1.11-1
bluez-libs-2.10-2
bluez-utils-2.10-2.1
on redhat 4.0 Enterprise Edition
with kernel 2.6.9-5.EL i386
int getScanName(bdaddr_t *device_bt,char * device_name,bdaddr_t

*dongle_bt)

Quoted 2 lines

{
if((s = GetScanSock(dongle_bt)) < 0) // this will connect to

local dongle

Quoted 5 lines
        {
                ERR_LOG(ERR,"Unable to open socket");
                return -s;
        }
        if(hci_read_remote_name(s,

device_bt,sizeof(device_name),device_name,0) < 0)

Quoted 10 lines
        {
                ERR_LOG(DBG,"No Name found");
                close(s);
                return -NOTFOUND;
        }
        ERR_LOG(DBG,"Name of Device hci scan  [%s] DeviceBT
[%s]",device_name,device_bt);
        close(s);
        return 0;
}
Quoted 9 lines

this function get called for each device found in scan.

I am in deep trouble to know what is problem with this.

Please help

-------------------------------------------------------------------------

Quoted 2 lines

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share

your

Quoted 2 lines

opinions on IT & business topics through brief surveys - and earn cash

http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Quoted 4 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

Signature · 5 lines
Impossible
itself contain
I M Possible

Vikas

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel