code: def read_inquiry_mode(sock):
      
      # save current filter
      old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14)
  
      # Setup socket filter to receive only events related to the
      # read_inquiry_mode command
      flt = bluez.hci_filter_new()
      opcode = bluez.cmd_opcode_pack(bluez.OGF_HOST_CTL, 
              bluez.OCF_READ_INQUIRY_MODE)
      bluez.hci_filter_set_ptype(flt, bluez.HCI_EVENT_PKT)
      bluez.hci_filter_set_event(flt, bluez.EVT_CMD_COMPLETE);
      bluez.hci_filter_set_opcode(flt, opcode)
      sock.setsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, flt )
  
      # first read the current inquiry mode.
      bluez.hci_send_cmd(sock, bluez.OGF_HOST_CTL, 
              bluez.OCF_READ_INQUIRY_MODE )
  
      pkt = sock.recv(255)
  
      status,mode = struct.unpack("xxxxxxBB", pkt)
      if status != 0: mode = -1
  
      # restore old filter
      sock.setsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, old_filter )
      return mode
docs: returns the current mode, or -1 on failure