This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Operation not supported (95) when using NRF52

Hi,

I am interested in using a pair of NRF52840 USB dongles to communicate on the L2CAP layer. I have flashed the dongles with the Zephyr's hci_usb samples, and have been able to connect the dongles with bluetoothctl. Now, I want to do the same using the socket functionality to use the L2CAP communication layer, however, I am receiving strerror EOPNOTSUPP (95): "Operation not supported", when using client-side connect() from sys/socket.h. I'm afraid I'm doing something conceptually wrong, but I also get the exact same error when trying hci_inquiry() from bluetooth/l2cap.h

Code example:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <errno.h>
extern int errno ;
int main(void)
{
struct sockaddr_l2 addr = { 0 };
int s, status;
char *message = "hello!";
char dest[18] = "ED:67:8A:54:94:40";
// allocate a socket
s = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
// set the connection parameters (who to connect to)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Some more info:

1) This isn't likely because I don't have a server-side listening since I get the same error with a different example using hci_inquiry() for scanning nearby devices.

2) The code reports "No route to host" (113) when unplugging the dongle.

3) Tried this code with NRF52_PCA10040 with hci_uart sample running.

4) Tried manually changing the default 00:00:00:00:00:00 address to something else.

5) Socket gets allocated properly

Hope you can help!