扫描大量BLE标签

6

我希望能够在单次扫描中扫描大量的BLE标签(StickNFind)。我发现当我扫描10秒时,可以轻松检测到约20个BLE。当我将扫描间隔增加到约30秒并尝试扫描大量的BLE标签,例如200个标签,我在LogCat中看到了缓冲区溢出(GKI_exception)的错误。这个问题出现在Android核心库中的某些地方,我无法进行调试。附上精确的错误日志。

11-27 11:39:30.542: D/dalvikvm(1017): GC_CONCURRENT freed 412K, 8% free 9039K/9760K, paused 1ms+1ms, total 16ms
11-27 11:39:30.552: D/BtGatt.GattService(1017): onScanResult() - address=E8:C6:AD:6F:BC:22, rssi=-76
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=10
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n96 len=3 dev_type=2
11-27 11:39:30.552: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.592: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.592: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.602: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.GattService(1017): onScanResult() - address=F7:09:63:BC:66:D0, rssi=-78
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=11
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.602: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.672: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:D0, rssi=-86
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=12
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.672: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.712: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.732: D/dalvikvm(1017): GC_CONCURRENT freed 385K, 8% free 9038K/9760K, paused 7ms+1ms, total 20ms
11-27 11:39:30.742: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:35, rssi=-94
11-27 11:39:30.742: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=13
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n8B len=3 dev_type=2
11-27 11:39:30.772: D/BtGatt.GattService(1017): onScanResult() - address=FC:A6:B0:A0:32:B6, rssi=-73
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.772: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=14
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:C2, rssi=-76
11-27 11:39:30.802: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=15
11-27 11:39:30.812: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:2D, rssi=-76
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=16
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=s8E len=3 dev_type=2
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.902: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.902: D/dalvikvm(1017): GC_CONCURRENT freed 480K, 8% free 9038K/9760K, paused 2ms+2ms, total 20ms

什么原因可能导致这样的问题,我该如何解决?
提前感谢!

你正在使用哪款安卓设备?在各种设备上,我都遇到了GKI_exception,并且每个设备导致这些异常的原因完全不同。 - reTs
1个回答

4
我认为我们无法完全解决这个问题,但是您可以尽可能地减少在onLeScan回调中的工作量,以降低出现此错误的可能性。该回调从系统内部的专用蓝牙线程调用。根据我的经验,在此回调/线程中执行大量工作会更容易导致您提到的错误发生。

编辑:我已经为此提交了一个错误报告:https://code.google.com/p/android/issues/detail?id=65455


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接