This patch adds the address type information to sockaddr_l2 structure,
allowing the userspace to inform the remote address type required for
LE Create Connection command.
In certain cross compiling environment, if we build the code with
enabling the maintainer mode, the following error happens.
cc1: warnings being treated as errors
lib/sdp.c: In function 'sdp_process':
lib/sdp.c:4111:6: error: comparison between signed and unsigned integer
expressions
make[2]: *** [lib/sdp.lo] Error 1
make[1]: *** [all] Error 2
LanguageBaseAttributeIDList is set from few places and each time static
function was copied and used for that. Move this funtion to sdp code
and use that instead of copying code.
Mac OS X 10.7.3 publishes the following SDP record for HFP Gateway.
record #2
aid 0x0000 (SrvRecHndl)
uint 0x10003
aid 0x0001 (SrvClassIDList)
< uuid-16 0x111f (Handsfree AG) uuid-16 0x1203 (Audio) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0x2 > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0006 (LangBaseAttrIDList)
< uint 0x656e uint 0x6a uint 0x100 >
aid 0x0009 (BTProfileDescList)
< uuid-16 0x111e (Handsfree) uint 0x105 >
aid 0x0100 (SrvName)
str "Hands Free Audio Gateway"
aid 0x0301 (SuppDataStoresList)
uint 0x0
aid 0x0311 (SuppFeatures)
uint 0x0
BlueZ do not read correctly the version number of the profile.
The patch fixes this.
From my understanding, the SDP profile descriptor is a list. The for
loop in sdp_get_profile_desc iterates that list. Until now, bluez
expected a collection of either uuid or lists with a uuid and a
version number. This can be represented as follow:
list=(uuid, uuid, (uuid, version))
The patch fixes the situation where the profile descriptor list
contains a uuid AND a version number both on the root level and not
enclosed in a sublist. If the next item after uuid is uint16, then
this is the version number. This can be represented as follow:
list=(uuid, uuid, version, uuid, (uuid, version))
Note that core v4.0 spec. states that the Profile Descriptor
list is a data sequence of profile descriptors. Each profile descriptor
is a data sequence whose first element is a UUID and second element is
a version number. This can be represented as follow:
list=((uuid, version), (uuid, version))
The compiler error is:
/usr/include/bluetooth/bluetooth.h::131:9: error: invalid conversion from 'void*' to 'bt_get_le64(void*)::<anonymous struct>*'
...
The reason is that C++, in contrast to C, does not allow conversion of
void * to anything, and this code gets compiled as C++ when the app is
written in C++. The macro with the assignment itself is older, but only
recent Bluez starts to use it in inline functions, thus triggering the
problem.
This patch keeps the "struct __attribute__((packed))" magic and merely
changes the typecast so that it works in C and C++. Like the existing
macro this patch relies on support for typeof.