Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. hci_inquiry timeout is wrong

hci_inquiry timeout is wrong

Scheduled Pinned Locked Moved Linux Programming
helpdebugginglounge
2 Posts 2 Posters 269 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jana_hus
    wrote on last edited by
    #1

    I have an issue with my usage of hci_inquiry function. When no devices are detected ,that is another issue I have but I need to fix this one first, it does not timeout as expected by "len" parameter value. The "elapsed time " is random , most of the time around 7s. When devices are actually detected the "elapsed time" is pretty much as expected, the function does work. I realize when no devices are detected is more important than how long it took to run, but I feel it should follow the "len" parameter. Would appreciate help or suggestion what else I can do to verify the function(s) time/ timeout when no devices are detected, Thanks

    len = 16; // 1.28 * len seconds timer max_rsp = 255;
    flags = IREQ_CACHE_FLUSH; //always real scan
    ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
    QET->start(); // debug restart timer

        num\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags);
    
        text = "\\nTASK  elapsed time...\\n ";
        text += "num\_rsp = hci\_inquiry(d....";
        //text += Q\_FUNC\_INFO;
        text += "  @ line  ";
        text += QString::number(\_\_LINE\_\_);
        text += "\\nElapsed time \\t";
        text += QString::number(QET->elapsed());
        text += " mS ";
        m\_ui->textEdit\_29->append(text);
        qDebug().noquote() << text;
        text = "\\nnum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags) \\t";
        text += QString::number(num\_rsp);
        m\_ui->textEdit\_29->append(text);
        qDebug().noquote() << text;
    
    K 1 Reply Last reply
    0
    • J jana_hus

      I have an issue with my usage of hci_inquiry function. When no devices are detected ,that is another issue I have but I need to fix this one first, it does not timeout as expected by "len" parameter value. The "elapsed time " is random , most of the time around 7s. When devices are actually detected the "elapsed time" is pretty much as expected, the function does work. I realize when no devices are detected is more important than how long it took to run, but I feel it should follow the "len" parameter. Would appreciate help or suggestion what else I can do to verify the function(s) time/ timeout when no devices are detected, Thanks

      len = 16; // 1.28 * len seconds timer max_rsp = 255;
      flags = IREQ_CACHE_FLUSH; //always real scan
      ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
      QET->start(); // debug restart timer

          num\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags);
      
          text = "\\nTASK  elapsed time...\\n ";
          text += "num\_rsp = hci\_inquiry(d....";
          //text += Q\_FUNC\_INFO;
          text += "  @ line  ";
          text += QString::number(\_\_LINE\_\_);
          text += "\\nElapsed time \\t";
          text += QString::number(QET->elapsed());
          text += " mS ";
          m\_ui->textEdit\_29->append(text);
          qDebug().noquote() << text;
          text = "\\nnum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags) \\t";
          text += QString::number(num\_rsp);
          m\_ui->textEdit\_29->append(text);
          qDebug().noquote() << text;
      
      K Offline
      K Offline
      k5054
      wrote on last edited by
      #2

      According to [this:](https://people.csail.mit.edu/albert/bluez-intro/c404.html#:~:text=The inquiry lasts for at most 1.28 \* len seconds) the timeout is at most len * 1.28 seconds. Since you've got a value of 16 for ii, then you can expect hci_inquiry() to take no more than 20.48 seconds. Since ~7 < 20.48, it looks to me that hci_inquiry is working as advertised.

      "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups