* [Bluez-users] problem reading rssi
@ 2007-03-30 3:18 Loreno Oliveira
2007-03-31 13:48 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Loreno Oliveira @ 2007-03-30 3:18 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1.1: Type: text/plain, Size: 1266 bytes --]
Hi,
I am having some headache for reading the rssi of a remote device. The code
bellow insists in returning 0 to the "rssi" variable when I try to read the
rssi of a connected Nokia 770. If I run the same code for a connected
desktop, then a non zero value is returned. For complicating even more, if I
run "hcitool clkoff <addr>" when connected to the 770, then a non zero value
is also returned.
struct hci_conn_info_req* cr;
bdaddr_t bdaddr;
int8_t rssi;
char* addr = device->client->getClientAddressAsString();
int sockId = device->dongle->getSocketId();
str2ba( addr, &bdaddr );
cr = (hci_conn_info_req*)malloc(sizeof(*cr) + sizeof(struct
hci_conn_info));
if( !cr ) {
perror( "Can't allocate memory" );
exit( 1 );
}
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
if( ioctl( sockId, HCIGETCONNINFO, (unsigned long) cr ) < 0 ) {
perror("Get connection info failed");
exit(1);
}
if( hci_read_rssi(sockId, htobs(cr->conn_info->handle), &rssi, 1000) < 0
) {
perror("Read RSSI failed");
exit(1);
}
printf("RSSI return value: %d\n", rssi);
free(cr);
return (int)rssi;
Does anyone have some idea about what is going wrong here?
Loreno
[-- Attachment #1.2: Type: text/html, Size: 1974 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-users] problem reading rssi
2007-03-30 3:18 [Bluez-users] problem reading rssi Loreno Oliveira
@ 2007-03-31 13:48 ` Marcel Holtmann
2007-03-31 16:28 ` Loreno Oliveira
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2007-03-31 13:48 UTC (permalink / raw)
To: BlueZ users
Hi Loreno,
> I am having some headache for reading the rssi of a remote device. The
> code bellow insists in returning 0 to the "rssi" variable when I try
> to read the rssi of a connected Nokia 770. If I run the same code for
> a connected desktop, then a non zero value is returned. For
> complicating even more, if I run "hcitool clkoff <addr>" when
> connected to the 770, then a non zero value is also returned.
it depends on the local adapter you use and the Bluetooth chip in the
remote device. Some devices don't report the correct RSSI value. It
seems they always return 0.
Regards
Marcel
-------------------------------------------------------------------------
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-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-users] problem reading rssi
2007-03-31 13:48 ` Marcel Holtmann
@ 2007-03-31 16:28 ` Loreno Oliveira
0 siblings, 0 replies; 3+ messages in thread
From: Loreno Oliveira @ 2007-03-31 16:28 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1.1: Type: text/plain, Size: 1952 bytes --]
Thanks for answer Marcel.
However, i think this is not the case. In some test I have made, I put two
scripts to run at the same time. The first one used hcitool for getting the
RSSI, the second one used my program to get the RSSI. Looking to the prints
on the terminal window, my program returned zero for the RSSI value while
hcitool returned a non zero value...
I am quite confused with this result. The code I am using for getting the
rssi is the same as the code hcitool uses. As far as a saw, the whole code
necessary for measuring rssi through hcitool is within the "cmd_rssi"
function. Is that right or there is some state outside cmd_rssi that impacts
in the correctness of the measurement?
Thanks again,
Loreno
On 3/31/07, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Loreno,
>
> > I am having some headache for reading the rssi of a remote device. The
> > code bellow insists in returning 0 to the "rssi" variable when I try
> > to read the rssi of a connected Nokia 770. If I run the same code for
> > a connected desktop, then a non zero value is returned. For
> > complicating even more, if I run "hcitool clkoff <addr>" when
> > connected to the 770, then a non zero value is also returned.
>
> it depends on the local adapter you use and the Bluetooth chip in the
> remote device. Some devices don't report the correct RSSI value. It
> seems they always return 0.
>
> Regards
>
> Marcel
>
>
>
> -------------------------------------------------------------------------
> 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-users mailing list
> Bluez-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
[-- Attachment #1.2: Type: text/html, Size: 2589 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-31 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30 3:18 [Bluez-users] problem reading rssi Loreno Oliveira
2007-03-31 13:48 ` Marcel Holtmann
2007-03-31 16:28 ` Loreno Oliveira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox