79420856

Date: 2025-02-07 12:21:39
Score: 2
Natty:
Report link

hci_inquiry: No such device error is posted using this example code

   // now it is device descfriptor !
dev_id = hci_get_route(NULL);

if (dev_id < 0) {
    perror("hci_get_route");
    exit(EXIT_FAILURE);
}
else
{
    text = "SUCCESS constructor  " ;
    qDebug()<< text;

}

if (dev_id < 0) {
    perror("hci_get_route");
    exit(EXIT_FAILURE);
}
else
{
    text = "SUCCESS hci_get_route constructor \n" ;
    text += " dev_id \t" ;
    text += QString::number(dev_id);
    //debug->append(text);
    qDebug()<< text;

}

// back to device descriptor ??

int dd = hci_open_dev(dev_id);

//if(dd != 0 )
{
    text = " device descriptor ";
    text += QString::number(dd);
    qDebug()<< text;
}





//debug->append(text);

int sock = hci_open_dev( dev_id );

if (dev_id < 0 || sock < 0) {




    perror("opening socket");
    exit(1);
}
if (sock < 0) {
    text = "FAILURE  hci_open_dev \n" ;
    text += " sock \t" ;
    text += QString::number(sock);
    //debug->append(text);
    qDebug()<< text;



    perror("hci_open_dev");
    exit(1);
}
else
{
    text = "SUCCESS sock = hci_open_dev constructor \n" ;
    text += " sock \t" ;
    text += QString::number(sock);
    //debug->append(text);
    qDebug()<< text;
}

//debug->append(text);

// Perform inquiry (scan for devices)
num_rsp = hci_inquiry(sock, 1, 10, NULL, &ii, 0);
if (num_rsp < 0) {

    text = "FAILURE  num_rsp = hci_inquiry constructor \n" ;
    text += " num_rsp  \t" ;
    text += QString::number(num_rsp);
    //debug->append(text);
    qDebug()<< text;

    //perror("hci_open_dev");
    //exit(1);
    perror("hci_inquiry");
    //exit(1);
}
else
{
    text = "SUCCESS   num_rsp = hci_inquiry constructor \n" ;
    text += " num_rsp  \t" ;
    text += QString::number(num_rsp);
    //debug->append(text);
    qDebug()<< text;

    //perror("hci_open_dev");
    //exit(1);
    perror("hci_inquiry");
    //exit(1);


}

This is actual MODIFIED partial code and it FAILS hci_inquiry for unknown reason. The Bluetooth service is verified and is running. PLEASE help to resolve. PS I am NOT allowed to ask my own question ....

Reasons:
  • RegEx Blacklisted phrase (3): PLEASE help to resolve
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jan Hus