When matching remote SEP to local SEP we do not match vendor codecs
properly, i.e. neither vendor ID not codec ID are checked, which may
cause wrong endpoint to be selected in case there are more that one
endpoints using vendor codec on remote.
This patch fixes this by assinging vendor codec indentification to
local SEP after it's registered and uses this information when matching
SEPs.
Connection state is not changed for incoming connection, i.e. during
discovery device is still in disconnected state and in case connection
fails for some reason, device won't be removed due to triggered state
change disconnected->disconnected which is silently ignored.
This patch fixes this problem by changing device state to connecting
immediately after signalling channel is connected. This allows device
to be removed properly in case something fails and is also consistent
with behaviour of Bluedroid.
In addition there's new flag added to device which stores information
whether we're initiator of connection. This is required because before
fix this property was decided based on HAL state which we can't now
use since it will be always connecting for both incoming and outgoing
connections.
As per spec (BT spec 4.1 Vol[3], Part F, chapter 3.4.5.4) we need to
take opcode, handle and parameters to generate signature.
In order to support it signing is moved to att.c, place where pdu is
encoded
We will receive signature counter as a part of signature in att packet.
We shall verify if signature counter has value as expected otherwise
drop the message.
Accourding to uHID documentation when diconnecting the kernel will take
care of cleaning up any device created:
"If you close() the fd, the device is automatically unregistered and
destroyed internally."
This is handled mostly the same way as read so we can use the same
function for sending att requests.
As test command parameters are of type uint16_t, we cannot write longer
values. We can figure out the ways to overcome this limitation if it
turns out that it's really needed (i.e. some PTS test cases cannot be
passed).
Wrong function was called resulting in read responses being send along
with write response. As it is now 'process_dev_pending_requests' is
processing only read requests.
This fixes the missleading error on crypto setup failure:
02-17 20:19:44.639 I/bluetoothd( 1705): bluetoothd[1706]: gatt: Failed
to allocate memory for queues