Skip to contentSkip to conversation

btio: Fix byte order conversion when getting L2CAP CID

PATCH Applied Santiago Carot-Nemesio 2 participants 2 messages Dec 5, 2011 – Dec 8, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btio: Fix byte order conversion when getting L2CAP CID

The L2CAP CID is passed and received in little endian byte order through the socket interface so a conversion is in place before passing it onwards.

---
 btio/btio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
btio/btio.c +1 -1
index f8c5cc7..0d177a3 100644
@@ -886,7 +886,7 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 			break;
 		case BT_IO_OPT_CID:
 			*(va_arg(args, uint16_t *)) = src.l2_cid ?
-						src.l2_cid : dst.l2_cid;
+					btohs(src.l2_cid) : btohs(dst.l2_cid);
 			break;
 		case BT_IO_OPT_OMTU:
 			*(va_arg(args, uint16_t *)) = l2o.omtu;
Signature · 1 line
1.7.8
#1 lore raw

Hi Santiago,

Quoted 6 lines · Santiago Carot-Nemesio

The L2CAP CID is passed and received in little endian byte order through the socket interface so a conversion is in place before passing it onwards.

---
 btio/btio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan