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

L2CAP does not work #418

Closed
KillerBOSS2019 opened this issue Oct 7, 2021 · 5 comments
Closed

L2CAP does not work #418

KillerBOSS2019 opened this issue Oct 7, 2021 · 5 comments

Comments

@KillerBOSS2019
Copy link

PyBluez is not under active development but we are seeking new contributors
to investigate bugs and submit patches.

System

  • Operating System: Windows 10 64bit
  • Hardware: External Bluetooth Adaptor (e.g., Raspberry Pi, external Bluetooth adaptor, etc.)
  • Python Version: 3.9.6
  • PyBluez Version: pybluez-0.30-py3.9-win-amd64.egg

Issue

I can't seems able to figure out how to connect to a L2CAP bluetooth device it always give me error says "ValueError: invalid protocol"
This is my code

remote = bluetooth.find_service(address=macAddress)[0]
# print(remote)
# print(bluetooth.L2CAP)
s = bluetooth.BluetoothSocket(bluetooth.L2CAP)
s.connect((remote['host'], remote['port']))
s.recv(4000)

also on top of that i tried to print(bluetooth.L2CAP) and it gave me value 0

@KillerBOSS2019
Copy link
Author

The device i am trying to connect is Amazon FireTV remote. Also from this info it looks like for me that it uses L2CAP
image

@dogtopus
Copy link
Collaborator

dogtopus commented Oct 8, 2021

L2CAP on Windows is never supported due to WinSock Bluetooth mode only have RFCOMM support. Apparently in order to be able to talk to other devices with Microsoft Bluetooth stack you have to write a kernel module that directly uses the low level Bluetooth API in kernel mode.

@KillerBOSS2019
Copy link
Author

So how do I do that? do u have a doc that you can link to me

@KillerBOSS2019
Copy link
Author

wait at https://docs.microsoft.com/en-us/windows-hardware/drivers/bluetooth/bluetooth-driver-stack it says

RfComm- The component that implements the Bluetooth serial cable emulation protocol. RfComm also uses the L2CAP and SDP interfaces found in BthPort. The upper edge of RfComm exposes the TDI interface, allowing this component to appear to be a networking transport. This is how WshBth connects to Bluetooth to send and receive data from user-mode APIs.

it says RFCOMM uses L2CAP. also a question If the L2CAP wasnt supported then how is this L2CAP BT device connect to this Windows?

@dogtopus
Copy link
Collaborator

dogtopus commented Oct 8, 2021

it says RFCOMM uses L2CAP.

Yes. However there's no low level L2CAP support. Only RFCOMM.

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

2 participants