Questions tagged [l2cap]

Bluetooth Logical link control and adaptation protocol resides in the data link layer.

l2cap
Filter by
Sorted by
Tagged with
28 votes
5 answers
51k views

Android BLE Connection time interval

I am developing a BLE application on Nexus 4 using Android BLE API. I have a few questions/doubts: 1) Is there a way to set/override the connection or notification interval of BLE central device. I ...
CoDe's user avatar
  • 11.1k
20 votes
1 answer
24k views

Bluetooth protocol (RFCOMM, L2CAP and ACL)

From what I've read from Bluetooth Essentials for Programmers, this books mentions some points that I dont quite understand. RFCOMM is a reliable stream-based protocol. L2CAP is a packet-based ...
Sam's user avatar
  • 4,543
8 votes
3 answers
11k views

Bluetooth LE L2CAP CID vs. PSM

I've been teaching myself how to write programs in C for BLE devices using the BlueZ API. However, I seem to be stumped on one particular aspect of the sockaddr_l2 struct. The definition I am using ...
Jeremy Roy's user avatar
7 votes
1 answer
9k views

How can I instantiate a L2Cap socket in Android?

I see that a Bluetooth socket can be of type TYPE_L2CAP, but the constructor for BluetoothSocket seems to be private and I can only find a method to instantiate a socket of type RFCOMM. How can I ...
nsndvd's user avatar
  • 800
7 votes
2 answers
2k views

Trying to bind bluetooth socket to PSM 17 and 19 returns EACCESS on MeeGo

I am trying to use Nokia N9 (meego) as a virtual Bluetooth mouse/keyboard. I am trying to use this small program as a starting point but I am running into problem: when I am running this program I get ...
sdkljhdf hda's user avatar
  • 1,397
7 votes
2 answers
4k views

Virtual HID-keyboard for OS X

I'm trying to create a virtual bluetooth keyboard client for Mac OS. that means my Mac will serve as a BT KB. I read about the bluetooth API in OS X (in ObjC), and I also found an HID API for Mac (in ...
eyalw's user avatar
  • 730
7 votes
1 answer
755 views

How Can I Establish A L2Capp Interrupt Channel Connection?

Im trying to open a L2Cap HID Channel And Interrupt channel so I can send HID commands to a bluetooth device. I've done all my service advertising and device paring and established a baseband ...
dubbeat's user avatar
  • 7,788
7 votes
0 answers
4k views

Bluetooth AVRCP control from Windows

I'm trying to implement an AVRCP/A2DP connection between my Android phone and my car PC. The A2DP bit basically works out of the box so no issue there. I want the PC to be the AVRCP CT (controller) ...
ChristianH's user avatar
6 votes
1 answer
2k views

Bluetooth LE - L2CAP CO Channel on android

I'm trying to connect an android device to an embedded control unit via L2CAP CO (Connection Oriented) with Bluetooth LE. Apple created in iOS a new function to create a custom L2CAP Channel https://...
javaBeCool's user avatar
5 votes
0 answers
2k views

Sending GAP ACL L2CAP Data Packets

To give some background on this question, try to test the CVE-2020-0022. Not sure how to trigger it in the end. Wrote this code that sends fragmented ACL L2CAP Data packets, so maybe somebody finds ...
dev's user avatar
  • 1,129
5 votes
0 answers
2k views

Establishing L2CAP connection over HCI

I have been trying to establish a BLE connection between and send data between two NRF52-52840 USB dongles via sockets. Moreover, I am interested in sending L2CAP data over the HCI layer. I am able ...
kajax's user avatar
  • 51
5 votes
0 answers
496 views

Bluetooth L2CAP server on Windows 10 (c#)

With iOS 11, Apple added support for MFI-free L2CAP protocol. I need to implement L2CAP server on C# (Windows 10) to allow ios client L2CAP connections. Does anyone know a good (or even any) reference ...
user2156173's user avatar
4 votes
1 answer
13k views

Connecting to a bluetooth HID device (mouse) using L2CAP

I'm tring to find a way to connect to a HID bevice (mouse) using L2CAP, this for a android app. but i'm getting error when accepting the connection. I'm using reflection to create the socket. but some ...
SAN's user avatar
  • 969
4 votes
0 answers
408 views

Use BLE L2CAP CoC on Windows

I am trying to use Windows PC as a Central and connect it to BLE L2CAP CoC opened by Android smartphone using BluetoothAdapter#listenUsingL2capChannel(). From what I found after looking through MSDN ...
Mirron's user avatar
  • 73
4 votes
0 answers
3k views

How to create Bluetooth L2CAP connection between two devices?

Android 10 released support for BLE CoC connection so I wanted to try this out by making two simple android 10 apps, which would connect to each other with l2Cap and exchange "Hello World". I wrote ...
Nikola Maksimovic's user avatar
4 votes
0 answers
1k views

How to open a L2CAP channel in a windows 10 GATT service?

We are trying to connect an iOS device to our BLE application in Windows 10 to send larger amounts of data. We were already able to successfully write data. To increase the throughput we want to ...
Alexander Belokon's user avatar
3 votes
2 answers
4k views

L2CAP Channel data transfer

I am working on developing BLE app using connection oriented channel . I am using nordic semiconductor nrf52 as a peripheral device and iPhone 6 as central manager. I have used predefined PSM value ...
blueWings's user avatar
3 votes
1 answer
2k views

How to send and receive data via CBL2CAPChannel

I'm trying to open an L2CAP channel between 2 iOS devices and transfer data both ways. One of the devices acts as a central the other one as a peripheral. On the peripheral side: I publish an ...
Mr Stanev's user avatar
  • 1,690
3 votes
3 answers
2k views

Does the iPhone sdk support l2cap bluetooth sockets?

Does the iPhone sdk support l2cap bluetooth sockets? Any additional information about SDK classes, etc would be greatly appreciated.
Paul Kelly's user avatar
  • 3,989
3 votes
1 answer
96 views

Proper way to setup NSStreams?

I'm writing a little peer-to-peer bluetooth chat app. What I'm currently doing is: let thread = Thread(block: { [weak self] in guard let `self` = self else { return } self.channel....
Peter Prokop's user avatar
3 votes
0 answers
397 views

Multiple L2CAP channels on iOS (rdar://46227689)

I'm trying to open two L2CAP channels between iPhone and app running on MacOS. MacOS app published two channels: PSM=193 and PSM=194. I open those channels on iOS app: peripheral.openL2CAPChannel(...
msmialko's user avatar
  • 1,529
3 votes
0 answers
602 views

BlueZ: Using LE Data Packet Length Extension from the command line

One of the main features of Bluetooth 4.2 was LE Data Length Packet Length Extension, which allowed Bluetooth devices to increase the LE packet from 27 octets to 251 octets, therefore significantly ...
Youssif Saeed's user avatar
3 votes
1 answer
2k views

Connecting with Bluetooth L2Cap to HID Device

Are there any workarounds to connect to HID device using L2CAP in JAVA ME (using JSR-82 specification implementation native to mobile device not BlueCove etc.)? I know that HID devices usually uses ...
user1610090's user avatar
3 votes
0 answers
1k views

How can I establish an AVRCP connection from Windows 7 (controller) to phone (target) using L2CAP on Widcomm SDK?

I am using the CL2Cap class in the Widcomm SDK on Win7. I am able to successfully establish the L2CAP connection and send the UNIT INFO command but the data returned is incorrect. I suspect that the ...
gCoder's user avatar
  • 31
3 votes
1 answer
476 views

View call stack of built-in Android app via Eclipse?

I am trying view the call stack of the Android bluetooth settings/setup app. Android 3.0 is able to pair with a bluetooth keyboard however the SDK does not expose this functionality. From what I ...
Buurin's user avatar
  • 129
2 votes
1 answer
5k views

Excessive Bluetooth LE timeouts on Linux?

I have written an application that uses Bluetooth LE L2CAP connections in nonblocking mode on Linux to read/write ATT packets (using socket(PF_BLUETOOTH, SOCK_SEQPACKET|SOCK_CLOEXEC, BTPROTO_L2CAP)). ...
yonran's user avatar
  • 18.5k
2 votes
2 answers
4k views

LE L2CAP Connection Oriented Channel - Stack/OS support

One of the features of Bluetooth v4.1 is the ability to exchange BLE data at the L2CAP layer. The L2CAP layer is lower than the GATT layer which will result in higher throughput of data exchange. I ...
Youssif Saeed's user avatar
2 votes
2 answers
3k views

Create and send a bluetooth command frame in Cocoa

I'm using the IOBluetooth Cocoa framework to communicate with a bluetooth device. So far I have gotten down the whole process of discovering the device and its services, pairing with it, connecting to ...
joshwbrick's user avatar
  • 5,922
2 votes
1 answer
1k views

How do I connect a L2CAP-based Bluetooth Camera Shutter (AB Shutter 3) to Linux and get the key event in Python?

Goal I have a HITSLAM Camera Shutter Bluetooth button (which is a AB Shutter 3 device, a common Bluetooth camera remote control) which I want to connect to my NVIDIA Jetson Nano using Bluetooth, so ...
codeabiswas's user avatar
2 votes
1 answer
2k views

L2CAP IOS + Linux (Bluez)

I'm trying to make a simple L2CAP Socket communication between IOS and a Linux PC. I've been able to: Create an L2CAP connection between two Linux machines (using example code from https://github....
inversus's user avatar
  • 1,287
2 votes
1 answer
301 views

Packet "0x71" transmitted by iPad over control channel in HIDP Bluetooth connection

iPad is transmitting a 0x71 packet immediately after connecting over the control L2CAP channel in a Bluetooth HIDP connection. Unless I respond with 0x00 byte immediately, over the same channel, iPad ...
Ivan Vučica's user avatar
  • 9,609
2 votes
1 answer
2k views

Android 10 L2CAP connection IOException timeout Wii Balance Board

Background A long time ago I was tasked with making a android app for the Wii Balance Board, after some screwing around I found that android no longer supported L2CAP. More research lead to understand ...
Jameson's user avatar
  • 190
2 votes
2 answers
4k views

L2CAP connection over an HCI socket?

The usual way to access L2CAP is to create an L2CAP socket and simply call connect() on it to connect to the bluetooth device you want to access. This usually works completely fine. However, I'm ...
Tim Tisdall's user avatar
  • 10.1k
2 votes
1 answer
2k views

Android Bluetooth l2cap socket bind()

Android version: 2.3.7 Kernel version: 2.6.35-14-CyanogenMod-Arco-Kalim arco@tuxbox #1 Mod version: CyanogenMod-7.1.0.1-click The device has been fully rooted. I have added piece of code in my ...
Sam's user avatar
  • 4,543
2 votes
1 answer
2k views

Cancelling retransmissions on a L2CAP socket

I was wondering if anyone can assist me with a problem that I have with C Bluetooth programming (Linux Bluez). I am using Ubuntu 10.04, BlueZ 4.60. My goal is to have a L2CAP socket in which there ...
eranre's user avatar
  • 21
2 votes
0 answers
256 views

Optimize Bluetooth LE L2CAP throughput between Linux running bluer l2cat and iOS

In transferring a raw stream of data over Bluetooth LE L2CAP between Linux and iOS, I get a throughput of approx. 9 kilobyte payload per sec. I expected to be able to transfer approx. 25 kB/s. How can ...
jksoegaard's user avatar
2 votes
0 answers
713 views

BluetoothSocket.connect() Android 12 Permission issue on certain devices

We use Bluetooth Low Energy L2CAP Channels (introduced in Android API Level 29) to transfer data to our BLE devices. Recently we've got reports that it's not working on this devices: Oppo Find X2 Pro,...
Niklas Dada's user avatar
2 votes
0 answers
222 views

can't send data through l2cap raw socket for local controller - [Errno 107] Transport endpoint is not connected

I tried to connect to my local bluetooth controller through l2cap layer in order to see which services I am supporting by using SDP protocol. **don't want to use sdptool with socket.socket(socket....
avi_tzanani's user avatar
2 votes
1 answer
362 views

Using CoreBluetooth CBL2CAPChannel to move data

I have set up some data transfer function, using CoreBluetooth CBL2CAPChannel, in a Swift iOS app. Here is the function for sending data: func sendData(_ outStream: OutputStream) -> Bool { let ...
Michel's user avatar
  • 11k
2 votes
0 answers
2k views

l2cap (113, 'No route to host')

I am using following code in rapsberry pi zero with bluetooth l2cap protocol. My client code always give me same error Error : Traceback (most recent call last): File "l2cap-client.py", line 11, in ...
Navneet Garg's user avatar
  • 1,374
2 votes
0 answers
588 views

Set L2CAP streaming mode in BlueZ

I need to create a simple L2CAP connection on BlueZ with the streaming mode enabled. Does anyone know how I can switch modes? At the moment, the connection has re-transmission enabled, and I need to ...
Zaphod's user avatar
  • 1,927
2 votes
1 answer
1k views

Getting currently playing song name in AVRCP or Establishing browsing channel in AVRCP

I am trying to create a AVRCP app on Andriod, from which I will be connecting to another device (smart phone). Currently I am able to play, pause songs of other device from my app, but I want to get ...
indrajit's user avatar
  • 129
1 vote
2 answers
807 views

Is it possible to connect to macOS from iOS via bluetooth using CBPeripheral

I am trying to connect iOS and macOS with bluetooth.They are already connected via bluetooth but when I try to retrieve them programmatically in swift using CBCentralManager, didDiscover peripheral it ...
md12's user avatar
  • 111
1 vote
1 answer
128 views

L2CAP communication in background mode

I tried to implement a simple demo application which handles communication with BLE devices while the application is put in background mode by the user. However, the communication seems to be ...
faku's user avatar
  • 441
1 vote
2 answers
181 views

CBL2CAPChannel not responsive while app is backgrounded

I'm facing an issue where L2CAP (or NSStream) stops notifying events to the app after app went to background (after 2-10 seconds). App is probably being suspended (as expected). My expectation is that ...
Pawel Klapuch's user avatar
1 vote
1 answer
723 views

Concurrent L2CAP and/or GATT Connections between 2 Devices

I was wondering if anybody here knows whether or not it is possible to have two active connections simultaneously between two devices. Device A would be the central role in one connection and that ...
Aditya's user avatar
  • 11
1 vote
1 answer
372 views

Why is android.bluetooth.BluetoothAdapter#listenUsingL2capOn(int) not accessible?

This might be a newbie question since my experience with Android is limited but for some reason I'm unable to access the method android.bluetooth.BluetoothAdapter#listenUsingL2capOn(int). It seems to ...
Divya Mamgai's user avatar
1 vote
1 answer
3k views

Android BT Stack in Kit Kat

I was wondering if anyone else was experiencing L2CAP connectivity issues with other devices. I have a device that worked fine under Android 4.1 but now that I'm on Kit Kat it is no longer working. ...
Lloyd's user avatar
  • 31
1 vote
1 answer
22 views

bluetoothLeScaner.startScan(scanCallback) isnt returning null

I am attempting to connect my phone to a bluetooth device. I am using an android 13 . In my scandevices file, I am coming across an issue on this line bluetoothLeScaner.startScan(scanCallback). I am ...
Liza Gildisch's user avatar
1 vote
2 answers
50 views

iOS Swift Facing issue on data transfer over CBL2CAPChannel

From central i am able to connect with Peripheral device and able to read the GATT data. Once peripheral connected i am opening the L2CAPChannel from central, which established successfully(logs i can ...
Jack Farnandish's user avatar