btsocket: support L2CAP, RFCOMM & SCO sockets

Python's socket module doesn't consistently provide these (depending
whether it saw bluetooth.h during build or not), and provides old
versions - so support bind() on them too.

BUG=chromium:256771
TEST=import btsocket, socket
  s1 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, btsocket.BTPROTO_L2CAP)
  s1.bind((btsocket.BDADDR_ANY, 0))

  s2 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_STREAM, btsocket.BTPROTO_RFCOMM)
  s2.bind((btsocket.BDADDR_ANY, 1))

  s3 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_RAW, btsocket.BTPROTO_HCI)
  s3.bind((0, btsocket.HCI_CHANNEL_RAW))

  s4 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_RAW, btsocket.BTPROTO_HCI)
  s4.bind((btsocket.HCI_DEV_NONE, btsocket.HCI_CHANNEL_CONTROL))

  s5 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_RAW, btsocket.BTPROTO_HCI)
  s5.bind((btsocket.HCI_DEV_NONE, btsocket.HCI_CHANNEL_MONITOR))

  s6 = btsocket.socket(btsocket.AF_BLUETOOTH, socket.SOCK_STREAM, btsocket.BTPROTO_SCO)
  s6.bind((btsocket.BDADDR_ANY))

Change-Id: I6d44a11b667e96d7fa3334df80e383911d658405
7 files changed
tree: de7d8ed6bae941bf2012f2fe61b1a2fc8fa24441
  1. .gitignore
  2. LICENSE
  3. PRESUBMIT.cfg
  4. btsocket/
  5. setup.py
  6. src/