factory-4455.B - chromiumos/platform/btsocket - Git at Google (original) (raw)

Implement bind() and recvmsg() for Bluetooth sockets

  1. Python's socket.bind() method does not supply the hci_channel member of the sockaddr_hci.

  2. Python 2.7 does not provide the recvmsg() syscall (3.3 finally does).

Implement a module that wraps the built-in socket object replacing the bind() method call with one that calls a C-implemented wrapper for bind() that can provide the extra argument, and that provides recvmsg() and recvmsg_into() methods that call a C implementation.

The recvmsg() and recvmsg_into() method calls are based on the Python 3.3 API.

src/bluetooth.h and src/hci.h are copied verbatim from BlueZ 5.4 without modification.

BUG=chromium:256771 TEST=import socket, btsocket s = btsocket.socket() s.bind((btsocket.HCI_DEV_NONE, btsocket.HCI_CHANNEL_MONITOR)) s.setsockopt(socket.SOL_SOCKET, btsocket.SO_TIMESTAMP, 1) b1 = bytearray(6) b2 = bytearray(btsocket.HCI_MAX_ACL_SIZE - 6) s.recvmsg_into((b1, b2), 32, 0)

Change-Id: Id464ea3744d0c9d01c3ce244013b462d1d27b498

9 files changed