I'm using the Bluetooth Classic SPP profile provided by esp-idf bluedroid, in VFS mode.
The VFS mode allows the user to mak non-blocking calls to read() write() and close() functions.
I expected the interface to behave just like fd streams or sockets opened with the O_NONBLOCK flag, but this is not the case.
Assume the call "len = read(fd, ...);"
Expected:
if the user disconnected: len=0
if there's no data available: len=-1 and errno=EWOULDBLOCK
BT SPP VFS:
if the user disconnected: nothing
if there's no data available: len=0
This divergence divergence doesn't allow SPP fds to be used like normal fds.
In my current project, for example, I use both TCP sockets and SPP fds in two separate arrays.
Since they work differently, I need to have some almost duplicate code to treat the inputs.
Describe the solution you'd like.
The bluetooth SPP VFS should set len=-1 and errno=EWOULDBLOCK when no data is available.
It would also be interesting to have a VFS blocking mode for the SPP API.
Is your feature request related to a problem?
I'm using the Bluetooth Classic SPP profile provided by esp-idf bluedroid, in VFS mode.
The VFS mode allows the user to mak non-blocking calls to read() write() and close() functions. I expected the interface to behave just like fd streams or sockets opened with the O_NONBLOCK flag, but this is not the case.
Assume the call "len = read(fd, ...);"
Expected: if the user disconnected: len=0 if there's no data available: len=-1 and errno=EWOULDBLOCK
BT SPP VFS: if the user disconnected: nothing if there's no data available: len=0
This divergence divergence doesn't allow SPP fds to be used like normal fds.
In my current project, for example, I use both TCP sockets and SPP fds in two separate arrays. Since they work differently, I need to have some almost duplicate code to treat the inputs.
Describe the solution you'd like.
The bluetooth SPP VFS should set len=-1 and errno=EWOULDBLOCK when no data is available.
It would also be interesting to have a VFS blocking mode for the SPP API.
Describe alternatives you've considered.
No response
Additional context.
No response