title: Bluetooth device name and corresponding serial port name in python
body: <p>I have a Bluetooth enabled device with user-friendly name "Sensor1". This device uses the SPP profile. In order to ask the device to start data streaming via Bluetooth, I have to write <strong>'10111011'</strong> on the COM port corresponding to this device as follows:</p>
  
  <pre><code>ser = serial.Serial('COM5') 
  ser.write('10111011')     
  </code></pre>
  
  <p>Problem is that I do not know which one of the COM ports corresponds to "Sensor1". So, I read windows registry to get the device name:  </p>
  
  <pre><code>import _winreg as reg
  from itertools import count
  
  key = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, 'HARDWARE\\DEVICEMAP\\SERIALCOMM')
  for i in count():
      device, port = reg.EnumValue(key, i)[:2]
      print "Device name \"%s\" found at %s" % (device, port)
  </code></pre>
  
  <p>All I get is:</p>
  
  <pre><code>Device name \Device\Serial0 found at COM3
  Device name \Device\BthModem16 found at COM4
  Device name \Device\BthModem17 found at COM5
  </code></pre>
  
  <p>How can I get the device name as in:</p>
  
  <pre><code>service = bluetooth.find_service()
  print service["name"]
  </code></pre>