Return-Path: Message-ID: Date: Fri, 30 Mar 2007 00:18:01 -0300 From: "Loreno Oliveira" To: "BlueZ users" MIME-Version: 1.0 Subject: [Bluez-users] problem reading rssi Reply-To: BlueZ users List-Id: BlueZ users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1302257194==" Sender: bluez-users-bounces@lists.sourceforge.net Errors-To: bluez-users-bounces@lists.sourceforge.net --===============1302257194== Content-Type: multipart/alternative; boundary="----=_Part_66621_15986824.1175224681626" ------=_Part_66621_15986824.1175224681626 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 " 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 ------=_Part_66621_15986824.1175224681626 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
------=_Part_66621_15986824.1175224681626-- --===============1302257194== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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 --===============1302257194== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bluez-users mailing list Bluez-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-users --===============1302257194==--