<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nRF52832 to Linux L2CAP socket?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68408/nrf52832-to-linux-l2cap-socket</link><description>I&amp;#39;m trying to get an nRF52832 to connect to a Linux host with a BLE adapter. The Linux host is listening for connections via an L2CAP socket, as in the (simplified) code below: 
 
 
 How can I get the Nordic radio to connect to this? I&amp;#39;m using SoftDevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Nov 2020 15:27:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68408/nrf52832-to-linux-l2cap-socket" /><item><title>RE: nRF52832 to Linux L2CAP socket?</title><link>https://devzone.nordicsemi.com/thread/281634?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 15:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:323be034-d944-4879-9596-126df968899c</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you are talking about using a connectionless channel I think that is only supported in BR/EDR and is used for unicasting. For L2CAP&amp;nbsp; connection oriented channels, you first need to have an LE ACL&amp;nbsp; link, then you can configure L2CAP channels on top of that. Meaning it is not possible to setup a L2CAP channel using BTLE without going through the normal advertisement /scanning procedure to create a link.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 to Linux L2CAP socket?</title><link>https://devzone.nordicsemi.com/thread/281166?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 16:25:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:417fe360-51ad-4a63-a42c-95996da43495</guid><dc:creator>kdev</dc:creator><description>&lt;p&gt;Those examples, unfortunately, do not work.&amp;nbsp; They all require scanning for an advertising device before connecting.&amp;nbsp; Meanwhile, the Linux L2CAP sockets don&amp;#39;t seem to advertise or scan at all.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an even more straightforward example of the Linux side of things:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;import socket

remoteMac = &amp;quot;00:11:22:33:44:55&amp;quot; # remote device&amp;#39;s bluetooth MAC address
port = 4123 # arbitrary port number

isServer = False

s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

if isServer:
    s.bind( (socket.BDADDR_ANY, port) )
    s.listen()
    s.accept()
else:
    s.connect( (remoteMac, port) )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When running this with isServer = False and monitoring Bluetooth activity with Wireshark, Wireshark doesn&amp;#39;t record any scanning commands or results, instead just an HCI connect command:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/l2cap_5F00_socket_5F00_connect_5F00_attempt.pcapng"&gt;devzone.nordicsemi.com/.../l2cap_5F00_socket_5F00_connect_5F00_attempt.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And when running with isServer = True, Wireshark records no Bluetooth activity at all until a remote device initiates a connection.&amp;nbsp; There are no commands to begin advertising or anything similar.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So to connect to this from the nrf52832, how do I tell the SoftDevice to initiate a connection to a remote address directly, without scanning for advertisements that don&amp;#39;t exist?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 to Linux L2CAP socket?</title><link>https://devzone.nordicsemi.com/thread/280888?ContentTypeID=1</link><pubDate>Thu, 19 Nov 2020 12:40:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a2d7753-7d8b-414e-a4df-4c0bbac2083f</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not familiar with the Linux host api&amp;#39;s you are using. But I can mention we have the Object transfer service example, which is using L2CAP: &lt;br /&gt;&lt;span&gt;&lt;a title="Experimental: Object Transfer Service Server Application" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_ots.html?cp=7_1_4_2_2_31"&gt;Object Transfer Service Server Application&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a title="Experimental: Object Transfer Service client Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_ots_c.html?cp=7_1_4_2_0_10"&gt;Object Transfer Service client Example&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This might be useful for you to see how to set up L2CAP with our SD.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 to Linux L2CAP socket?</title><link>https://devzone.nordicsemi.com/thread/280362?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 13:09:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:790ce975-e43c-4270-b710-c19cd6d5b78e</guid><dc:creator>kdev</dc:creator><description>&lt;p&gt;Edit: In the script, &lt;code&gt;self._port&lt;/code&gt; is an arbitrary port number.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>