Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCI Selection Failure #501

Open
kg-meso opened this issue Feb 10, 2023 · 1 comment
Open

HCI Selection Failure #501

kg-meso opened this issue Feb 10, 2023 · 1 comment

Comments

@kg-meso
Copy link

kg-meso commented Feb 10, 2023

Hello, I have been really enjoying bluepy however I have came across an issue that is stopping me in my development. When setting the iface value to a string '0' or '1' in Peripheral() it fails to actually select one or the other and just defaults to hci0.

I have went into the btle.py file and added a print statement in _connect() to output 'hci'+str(iface) and it does correctly receive either a 0 or a 1. The reason I can tell which interface is being used is because I have hcidump open for both devices and can only see one every actually receiving hci commands no matter the value for iface.

Some things to note:

  • Using Raspberry Pi 4 with Raspbian V11 bullseye
  • Bluez 5.55 (bluetoothd -v called to find this)
  • BL654 (NRF52840) dongle (I can get data on this just fine using bluepy)
  • The documentation states that iface corresponds to /dev/hci+str(iface) however on my pi the /dev/ folder corresponds to ports and there are no hci devices with an id listed there. I can see them listed in bluetoothctl, btmon, btmgmt, and hciconfig though.

I would love to keep using bluepy but I need to get this issue fixed moving forward, I am happy to also work on a pull request to fix this once I get some help sorting out the actual issue! Thanks.

Here is some sample code from my project:

def initiate_peripheral(addr,type,hci):
p = Peripheral()
p.connect(addr,type,str(hci))
p.withDelegate(MyDelegate(p))
p.setMTU(251)
return p

p = initiate_peripheral(args['macid'],'random',args['hci_id'])

@kg-meso
Copy link
Author

kg-meso commented Feb 13, 2023

A further note, using bluepy-helper and calling it with a 0 or a 1 at the end like so,

  • ./bluepy-helper 1
  • ./bluepy-helper 0

In this case, connecting with conn adding an hciX on the end still does not work. However, I can actually call scan and it will change which hci device being used depending on how I called ./bluepy-helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant