Export to GitHub

pybluez - issue #77

No way to select device id for device discovery


Posted on Feb 3, 2015 by Helpful Panda

My Linux device contains 3 dongles (class 1,2,3). I want to select one of them for device discovery (user may select which to use via a GUI). Is there a way to select hci0,1,2 through code?

Al my tests with socket.bind did not work.

Any tips?

Thanks in advance!

Mart

Comment #1

Posted on Feb 4, 2015 by Quick Horse

It seems to be not supported feature.

You could change line 20-21 in: https://code.google.com/p/pybluez/source/browse/bluetooth/bluez.py to def discover_devices (duration=8, flush_cache=True, lookup_names=False, lookup_class=False, dev_id=-1): sock = _gethcisock (dev_id)

and then in script use it like: discover_devices(dev_id=YOUR_DEV_ID)

Let me know if it helps, if we can make it cross platform then i will make change in sources.

Comment #2

Posted on Feb 8, 2015 by Helpful Panda

Thx! I will try and let you know.

Kind regards,

Mart

Comment #3

Posted on Feb 8, 2015 by Quick Horse

(No comment was entered for this change.)

Comment #4

Posted on Feb 8, 2015 by Quick Horse

Ok I have a fix for that, but it was not as simple as I thought, its on new branch: https://code.google.com/p/pybluez/source/list?name=issue-77 Please test it and I will merge to master

Thanks

Comment #5

Posted on Feb 8, 2015 by Helpful Panda

Thanks for your great effort! I am not behind my pc at the moment. Will test and give you feedback asap!

Comment #6

Posted on Feb 10, 2015 by Quick Horse

Issue 25 has been merged into this issue.

Status: Accepted

Labels:
Type-Defect Priority-Medium