Skip to content

Cannot scan when device is bluetooth 5 #48

@maripo31

Description

@maripo31

Hello,
When device is bluetooth 5, the function self._use_ext_scan() return True.
Then HCI_Cmd_LE_Set_Extended_Scan_Enable is actived.
But the normal le scan is not actived and no beacon 4.0 message was received.

My suggestion is in send_scan_request to remove the else: and make always the 2 functions :
HCI_Cmd_LE_Set_Scan_Params and
HCI_Cmd_LE_Scan_Enable

Here is the patch
*** aioblescan.py 2022-03-01 17:36:54.794613192 +0000
--- aioblescan.py.old 2022-03-01 17:32:37.587643554 +0000
*************** class BLEScanRequester(asyncio.Protocol)
*** 1809,1821 ****
self._send_command_no_wait(command)

          command = HCI_Cmd_LE_Set_Extended_Scan_Enable(True, 0)
          self._send_command_no_wait(command)
  •     sparam = int(isactivescan)
    
  •     command = HCI_Cmd_LE_Set_Scan_Params(scan_type=sparam)
    
  •     self._send_command_no_wait(command)
    

! command = HCI_Cmd_LE_Scan_Enable(True, False)
! return self._send_command_no_wait(command)

  async def stop_scan_request(self):
      """Sending LE scan request"""

--- 1809,1822 ----
self._send_command_no_wait(command)

          command = HCI_Cmd_LE_Set_Extended_Scan_Enable(True, 0)
  •         return self._send_command_no_wait(command)
    
  •     else:
    
  •         sparam = int(isactivescan)
    
  •         command = HCI_Cmd_LE_Set_Scan_Params(scan_type=sparam)
            self._send_command_no_wait(command)
    

! command = HCI_Cmd_LE_Scan_Enable(True, False)
! return self._send_command_no_wait(command)

  async def stop_scan_request(self):
      """Sending LE scan request"""

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions