Discover and return a list of the names of all analog output channels for the given device

    :param dev: the device name
    :type dev: str
5388
def get_ao_chans(dev):
    
    buf = create_string_buffer(256)
    buflen = c_uint32(sizeof(buf))
    DAQmxGetDevAOPhysicalChans(dev.encode(), buf, buflen)
    pybuf = buf.value
    chans = pybuf.decode(u'utf-8').split(u",")
    return chans
505359
def list_devices(names=None, continue_from=None, **kwargs):
    """"""

    if not names:
        names = [device for device, _type in settings.GOLDEN_DEVICES if _type == 'OpenThread']

    if continue_from:
        continue_from = names.index(continue_from)
    else:
        continue_from = 0

    for port in names[continue_from:]:
        try:
            with OpenThreadController(port) as otc:
                print('%s: %s' % (port, otc.version))
        except:
            logger.exception('failed to get version of %s' % port)
243252
def get_output_data_port_m(self, data_port_id):
        
        for data_port_m in self.output_data_ports:
            if data_port_m.data_port.data_port_id == data_port_id:
                return data_port_m
        return None
695425
def find_interfaces(device, **kwargs):
    
    interfaces = []
    try:
        for cfg in device:
            try:
                interfaces.extend(usb_find_desc(cfg, find_all=True, **kwargs))
            except:
                pass
    except:
        pass
    return interfaces
1356636
def evdev_device(self):
        
        devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()]

        for device in devices:
            if device.name == self.evdev_device_name:
                return device

        raise Exception("%s: could not find evdev device '%s'" % (self, self.evdev_device_name))
667125
def find_bled112_devices(cls):
        """"""
        found_devs = []

        ports = serial.tools.list_ports.comports()
        for port in ports:
            if not hasattr(port, 'pid') or not hasattr(port, 'vid'):
                continue

            # Check if the device matches the BLED112's PID/VID combination
            if port.pid == 1 and port.vid == 9304:
                found_devs.append(port.device)

        return found_devs
620516
def loopback_devices():
    '''
    
    '''
    loopbacks = {}
    cmd = ['losetup', '-a']
    output = check_output(cmd)
    if six.PY3:
        output = output.decode('utf-8')
    devs = [d.strip().split(' ') for d in output.splitlines() if d != '']
    for dev, _, f in devs:
        loopbacks[dev.replace(':', '')] = re.search(r'\((\S+)\)', f).groups()[0]
    return loopbacks
1357105
def search_for_devices_by_serial_number(self, sn):
        
        import re

        sn_search = re.compile(sn)

        matches = []
        for dev_o in self.get_all_devices_in_portal():
            # print("Checking {0}".format(dev_o['sn']))
            try:
                if sn_search.match(dev_o['sn']):

                    matches.append(dev_o)
            except TypeError as err:
                print("Problem checking device {!r}: {!r}".format(
                                    dev_o['info']['description']['name'],
                                    str(err)))
        return matches
827764
def output_names(self):
        """"""
        if self.binded:
            return self._curr_module.output_names
        else:
            symbol, _, _ = self._call_sym_gen(self._default_bucket_key)
            return symbol.list_outputs()
1032952
def show_hids(target_vid = 0, target_pid = 0, output = None):
    """"""
    # first be kind with local encodings
    if not output:
        # beware your script should manage encodings
        output = sys.stdout
    # then the big cheese...
    from . import tools
    all_hids = None
    if target_vid:
        if target_pid:
            # both vendor and product Id provided
            device_filter = HidDeviceFilter(vendor_id = target_vid,
                    product_id = target_pid)
        else:
            # only vendor id
            device_filter = HidDeviceFilter(vendor_id = target_vid)

        all_hids = device_filter.get_devices()
    else:
        all_hids = find_all_hid_devices()
    if all_hids:
        print("Found HID class devices!, writting details...")
        for dev in all_hids:
            device_name = str(dev)
            output.write(device_name)
            output.write('\n\n  Path:      %s\n' % dev.device_path)
            output.write('\n  Instance:  %s\n' % dev.instance_id)
            output.write('\n  Port (ID): %s\n' % dev.get_parent_instance_id())
            output.write('\n  Port (str):%s\n' % str(dev.get_parent_device()))
            #
            try:
                dev.open()
                tools.write_documentation(dev, output)
            finally:
                dev.close()
        print("done!")
    else:
        print("There's not any non system HID class device available")
797955
def discover() -> List[Tuple[str, str]]:
    
    if IS_ROBOT and os.path.isdir('/dev/modules'):
        devices = os.listdir('/dev/modules')
    else:
        devices = []

    discovered_modules = []

    module_port_regex = re.compile('|'.join(MODULE_TYPES.keys()), re.I)
    for port in devices:
        match = module_port_regex.search(port)
        if match:
            name = match.group().lower()
            if name not in MODULE_TYPES:
                log.warning("Unexpected module connected: {} on {}"
                            .format(name, port))
                continue
            absolute_port = '/dev/modules/{}'.format(port)
            discovered_modules.append((absolute_port, name))
    log.info('Discovered modules: {}'.format(discovered_modules))

    return discovered_modules
1246719
function getDevices(adbPath: string): Array<string> {
  try {
    const devicesResult = execSync(`${adbPath} devices`);
    return parseDevicesResult(devicesResult.toString());
  } catch (e) {
    return [];
  }
}
258199
def getAllConnectedInterface():
        
        # find all devices matching the vid/pid specified
        dev = usb.core.find(idVendor=0x2886, idProduct=0x0007)

        if not dev:
            logging.debug("No device connected")
            return []

        interface_number = -1

        # get active config
        config = dev.get_active_configuration()

        # iterate on all interfaces:
        #    - if we found a HID interface
        for interface in config:
            if interface.bInterfaceClass == 0x03:
                interface_number = interface.bInterfaceNumber
                break

        if interface_number == -1:
            return []

        try:
            if dev.is_kernel_driver_active(interface_number):
                dev.detach_kernel_driver(interface_number)
        except Exception as e:
            print(e)

        ep_in, ep_out = None, None
        for ep in interface:
            if ep.bEndpointAddress & 0x80:
                ep_in = ep
            else:
                ep_out = ep

        """If there is no EP for OUT then we can use CTRL EP"""
        if not ep_in:
            logging.error('Endpoints not found')
            return []

        board = PyUSB()
        board.ep_in = ep_in
        board.ep_out = ep_out
        board.dev = dev
        board.intf_number = interface_number
        board.start_rx()

        return [board]
419691
def get_ports_by_name(device_name):
    ''''''
    filtered_devices = filter(
        lambda device: device_name in device[1],
        list_ports.comports()
    )
    device_ports = [device[0] for device in filtered_devices]
    return device_ports
661917
def get_digital_channels(channel_list):
    """"""
    dig_ids = digital_channel_ids()
    dig_channels = []
    for ln in dig_ids:
        for ch in channel_list:
            if ch.dct['id'] == ln:
                dig_channels.append(ch)
                break
    return dig_channels
426807
def get_all_connected_interfaces():
        """"""
        # find all cmsis-dap devices
        try:
            all_devices = usb.core.find(find_all=True, custom_match=HasCmsisDapv2Interface())
        except usb.core.NoBackendError:
            common.show_no_libusb_warning()
            return []

        # iterate on all devices found
        boards = []
        for board in all_devices:
            new_board = PyUSBv2()
            new_board.vid = board.idVendor
            new_board.pid = board.idProduct
            new_board.product_name = board.product
            new_board.vendor_name = board.manufacturer
            new_board.serial_number = board.serial_number
            boards.append(new_board)

        return boards
374821
def audio_output_enumerate_devices(self):
        
        r = []
        head = libvlc_audio_output_list_get(self)
        if head:
            i = head
            while i:
                i = i.contents
                d = [{'id':       libvlc_audio_output_device_id      (self, i.name, d),
                      'longname': libvlc_audio_output_device_longname(self, i.name, d)}
                   for d in range(libvlc_audio_output_device_count   (self, i.name))]
                r.append({'name': i.name, 'description': i.description, 'devices': d})
                i = i.next
            libvlc_audio_output_list_release(head)
        return r