pvdao / pybluez

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

Unknown Error (22, 'Invalid argument') #22

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This problem occured on version 0.16 (unpatched).
It is impossible to connect any device with the regular connect() function,
on a L2CAP socket.

A tiny script like :
import bluetooth.bluez

mac = '00:11:22:33:44:55'
recv = bluetooth.bluez.BluetoothSocket(bluetooth.L2CAP)
ctrl = bluetooth.bluez.BluetoothSocket(bluetooth.L2CAP)

recv.connect ((mac, 0x13))
ctrl.connect ((mac, 0x11))

if recv and ctrl :
    print "ok"
else:
    print "nok"

would raise a BluetoothError exception.

Traceback (most recent call last):
  File "./test.py", line 15, in <module>
    recv.connect ((mac, 0x13))
  File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: (22, 'Invalid argument')

This occured on :
- Fedora 11 Leonidas (tested on x86_64 and x86)
- PyBluez 0.16 (tested with RPM and regular SVN)
- bluez 4.42

Found a patch (attached) on the following page that seems to be working:
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg660555.html

Works like a charm with this patch !

Original issue reported on code.google.com by tuxxych...@gmail.com on 4 Oct 2009 at 6:51

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

I believe this is fixed in the new 0.17 release.  Please test it if you have a
chance, and let me know so I can close this issue.

Original comment by ashu...@gmail.com on 19 Oct 2009 at 8:14

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
On ubuntu 9.10 with 2.6.31 kernel, this issue occured with the 0.17 too.
The same patch works.

Original comment by delayen.florent on 31 Oct 2009 at 11:19

GoogleCodeExporter commented 8 years ago
I confirm what darkevolution just said. It still doesn't work without the patch 
on 
0.17.

Original comment by tuxxych...@gmail.com on 1 Nov 2009 at 7:00

GoogleCodeExporter commented 8 years ago
Ok, I've no idea why the patch should make any difference, but I'll apply it 
anyway
since I don't have a 2.6.30+ machine to test on, and the patch looks fairly 
innocuous
otherwise.

Original comment by ashu...@gmail.com on 1 Nov 2009 at 10:21

GoogleCodeExporter commented 8 years ago
Hi,

I assume this patch has been applied to 0.18.

Unfortunately, I still get the error message above with Ubuntu 9.10,
2.6.31-15-generic kernel and bluez 4.58 :-(

Original comment by Daniel.C...@gmail.com on 30 Nov 2009 at 2:07

GoogleCodeExporter commented 8 years ago
Correct, the patch has been applied to 0.18.  Well, it's a bummer it still 
doesn't
work, since a lot of people are migrating to 9.10 now.  Unfortunately, I 
currently
don't have time to look into this myself...

Original comment by ashu...@gmail.com on 30 Nov 2009 at 9:34

GoogleCodeExporter commented 8 years ago
This patch worked for me too, Fedora 12 with pybluez 0.18.
Daniel.Chr.Schmidt2, are you sure you use pybluez 0.18? How did you install it?
If you compiled it from source, could it be that there is still an older 
version on 
your system, for example one from your package manager?
What does python -c "import bluetooth; print bluetooth.__path__" report?

Original comment by L...@gmx.at on 30 Nov 2009 at 10:21

GoogleCodeExporter commented 8 years ago
Thank you very much for your help. You were right, I actually had the 
0.16-ubuntu
package installed as well, of which I wasn't aware of. Removing it fixed my 
problems. :-)

Original comment by Daniel.C...@gmail.com on 1 Dec 2009 at 7:49

GoogleCodeExporter commented 8 years ago
Thanks for your report, I think I can close this bug now

Original comment by L...@gmx.at on 2 Dec 2009 at 9:46

GoogleCodeExporter commented 8 years ago
i dont know how to add this patch
Someone please help me

Original comment by mailswap...@gmail.com on 12 Jun 2012 at 9:56