summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-04 11:19:04 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-04 11:19:04 +0300
commiteb0214a462f5aa159a948a992e141f4d8ddf443d (patch)
tree83d9d93e6e2bc7da23e620666f4e1533e16c24c1
parentdbd9c3109e77088de3d7e35dec78524ba73d1ad4 (diff)
downloadbluez-eb0214a462f5aa159a948a992e141f4d8ddf443d.tar.gz
core: Add GoepL2capPsm lookup for external OBEX profiles
-rw-r--r--src/profile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/profile.c b/src/profile.c
index 11bc05866..338e9036e 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -698,6 +698,24 @@ static int connect_io(struct ext_io *conn, bdaddr_t *src, bdaddr_t *dst)
return 0;
}
+static uint16_t get_goep_l2cap_psm(sdp_record_t *rec)
+{
+ sdp_data_t *data;
+
+ data = sdp_data_get(rec, SDP_ATTR_GOEP_L2CAP_PSM);
+ if (!data)
+ return 0;
+
+ if (data->dtd != SDP_UINT16)
+ return 0;
+
+ /* PSM must be odd and lsb of upper byte must be 0 */
+ if ((data->val.uint16 & 0x0101) != 0x0001)
+ return 0;
+
+ return data->val.uint16;
+}
+
static void record_cb(sdp_list_t *recs, int err, gpointer user_data)
{
struct ext_io *conn = user_data;
@@ -737,6 +755,9 @@ static void record_cb(sdp_list_t *recs, int err, gpointer user_data)
if (port > 0)
ext->chan = port;
+ if (ext->psm == 0 && sdp_get_proto_desc(protos, OBEX_UUID))
+ ext->psm = get_goep_l2cap_psm(rec);
+
sdp_list_foreach(protos, (sdp_list_func_t) sdp_list_free,
NULL);
sdp_list_free(protos, NULL);