SoonSYJ / pybluez

Automatically exported from code.google.com/p/pybluez
GNU General Public License v2.0
0 stars 0 forks source link

No way to select device id for device discovery #77

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by mart.ste...@gmail.com on 3 Feb 2015 at 6:56

GoogleCodeExporter commented 8 years ago
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.

Original comment by karu...@wp.pl on 4 Feb 2015 at 8:53

GoogleCodeExporter commented 8 years ago
Thx! I will try and let you know.

Kind regards,

Mart

Original comment by mart.ste...@gmail.com on 8 Feb 2015 at 1:15

GoogleCodeExporter commented 8 years ago

Original comment by karu...@wp.pl on 8 Feb 2015 at 6:00

GoogleCodeExporter commented 8 years ago
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

Original comment by karu...@wp.pl on 8 Feb 2015 at 6:04

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

Original comment by mart.ste...@gmail.com on 8 Feb 2015 at 8:45

GoogleCodeExporter commented 8 years ago
Issue 25 has been merged into this issue.

Original comment by karu...@wp.pl on 10 Feb 2015 at 6:39