HCI_GET_ROUTE返回“无设备”

问题描述 投票:0回答:2

并用

检查状态
systemctl status bluetooth.service

响应是“运行”的,所以我运行了应用程序,但是

hci_get_route
返回不良ID,而Errno是“没有这样的设备”。我忘记了什么?
thanks

命令通过命令行激活BT接口:

bluetooth yocto
2个回答
0
投票

  1. hciattach /dev/ttyUSB0 any

    
    

  2. hciconfig hci0 up

    
    

  3. 这三个步骤
  4. hcitool dev

    显示BT接口和呼叫

    hci_get_route
    HW重新启动后不需要步骤1,您只需执行步骤2&3

HCI_INQUIRY:使用此示例代码

未发布此类设备错误
// 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); }
这是实际修改的部分代码,由于未知原因,它失败了HCI_Inquiry。蓝牙服务已验证并正在运行。请帮助解决。 PS我不允许问我自己的问题。
    


0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.