Returns info about the attached monitors, in device order

        [0] is always the primary monitor
767458
def _getMonitorInfo(self):
        
        monitors = []
        CCHDEVICENAME = 32
        def _MonitorEnumProcCallback(hMonitor, hdcMonitor, lprcMonitor, dwData):
            class MONITORINFOEX(ctypes.Structure):
                _fields_ = [("cbSize", ctypes.wintypes.DWORD),
                            ("rcMonitor", ctypes.wintypes.RECT),
                            ("rcWork", ctypes.wintypes.RECT),
                            ("dwFlags", ctypes.wintypes.DWORD),
                            ("szDevice", ctypes.wintypes.WCHAR*CCHDEVICENAME)]
            lpmi = MONITORINFOEX()
            lpmi.cbSize = ctypes.sizeof(MONITORINFOEX)
            self._user32.GetMonitorInfoW(hMonitor, ctypes.byref(lpmi))
            #hdc = self._gdi32.CreateDCA(ctypes.c_char_p(lpmi.szDevice), 0, 0, 0)
            monitors.append({
                "hmon": hMonitor,
                #"hdc":  hdc,
                "rect": (lprcMonitor.contents.left,
                         lprcMonitor.contents.top,
                         lprcMonitor.contents.right,
                         lprcMonitor.contents.bottom),
                "name": lpmi.szDevice
                })
            return True
        MonitorEnumProc = ctypes.WINFUNCTYPE(
            ctypes.c_bool,
            ctypes.c_ulong,
            ctypes.c_ulong,
            ctypes.POINTER(ctypes.wintypes.RECT),
            ctypes.c_int)
        callback = MonitorEnumProc(_MonitorEnumProcCallback)
        if self._user32.EnumDisplayMonitors(0, 0, callback, 0) == 0:
            raise WindowsError("Unable to enumerate monitors")
        # Clever magic to make the screen with origin of (0,0) [the primary monitor]
        # the first in the list
        # Sort by device ID - 0 is primary, 1 is next, etc.
        monitors.sort(key=lambda x: (not (x["rect"][0] == 0 and x["rect"][1] == 0), x["name"]))

        return monitors
1260715
def list_():
    '''
    
    '''
    ret = {}
    for line in (__salt__['cmd.run_stdout']
                    (['mdadm', '--detail', '--scan'],
                     python_shell=False).splitlines()):
        if ' ' not in line:
            continue
        comps = line.split()
        device = comps[1]
        ret[device] = {"device": device}
        for comp in comps[2:]:
            key = comp.split('=')[0].lower()
            value = comp.split('=')[1]
            ret[device][key] = value
    return ret
1045863
def power_devices(self):
        
        if not self.__power_devices:
            self.__power_devices = PowerDevices(self.__connection)
        return self.__power_devices
815759
private Monitor getMonitorJustAcquired(List<ThreadLock.Monitor> monitors) {
        if (monitors.isEmpty()) return null;
        Monitor monitor = monitors.get(0);
        if (monitor.getDepth() != 0) return null;

        for (Monitor duplicateCandidate: monitors) {
            if (monitor.equals(duplicateCandidate)) continue; // skip first - equality includes monitor depth

            if (monitor.getLock().equals(duplicateCandidate.getLock())) return null; // Acquired earlier
        }

        return monitor;
    }
296345
def trusted_devices(self):
        
        request = self.session.get(
            '%s/listDevices' % self._setup_endpoint,
            params=self.params
        )
        return request.json().get('devices')
1197909
def monitors(self):
        # type: () -> Monitors
        

        if not self._monitors:
            int_ = int
            core = self.core

            # All monitors
            # We need to update the value with every single monitor found
            # using CGRectUnion.  Else we will end with infinite values.
            all_monitors = CGRect()
            self._monitors.append({})

            # Each monitors
            display_count = ctypes.c_uint32(0)
            active_displays = (ctypes.c_uint32 * self.max_displays)()
            core.CGGetActiveDisplayList(
                self.max_displays, active_displays, ctypes.byref(display_count)
            )
            rotations = {0.0: "normal", 90.0: "right", -90.0: "left"}
            for idx in range(display_count.value):
                display = active_displays[idx]
                rect = core.CGDisplayBounds(display)
                rect = core.CGRectStandardize(rect)
                width, height = rect.size.width, rect.size.height
                rot = core.CGDisplayRotation(display)
                if rotations[rot] in ["left", "right"]:
                    width, height = height, width
                self._monitors.append(
                    {
                        "left": int_(rect.origin.x),
                        "top": int_(rect.origin.y),
                        "width": int_(width),
                        "height": int_(height),
                    }
                )

                # Update AiO monitor's values
                all_monitors = core.CGRectUnion(all_monitors, rect)

            # Set the AiO monitor's values
            self._monitors[0] = {
                "left": int_(all_monitors.origin.x),
                "top": int_(all_monitors.origin.y),
                "width": int_(all_monitors.size.width),
                "height": int_(all_monitors.size.height),
            }

        return self._monitors
198967
def connected_inports(self):
        '''

        '''
        return [p for p in self.ports \
                if p.__class__.__name__ == 'DataInPort' and p.is_connected]
909957
def get_xid_devices():
    
    devices = []
    scanner = XidScanner()
    for i in range(scanner.device_count()):
        com = scanner.device_at_index(i)
        com.open()
        device = XidDevice(com)
        devices.append(device)
    return devices
1196748
def _find_display(self):
        
        self.display_num = 2
        while os.path.isdir(XVFB_PATH % (self.display_num,)):
            self.display_num += 1
970553
def display(self):
        
        for line in self.adb_shell('dumpsys display').splitlines():
            m = _DISPLAY_RE.search(line, 0)
            if not m:
                continue
            w = int(m.group('width'))
            h = int(m.group('height'))
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
        else:
            w, h = self.info['displayWidth'], self.info['displayHeight']
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
343452
def get_devices(self):
        
        def process_result(result):
            return [self.get_device(dev) for dev in result]

        return Command('get', [ROOT_DEVICES], process_result=process_result)
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]
1252684
def get_display(self):
        
        log.debug("getting display information...")
        cmd, url = DEVICE_URLS["get_display"]
        return self._exec(cmd, url)
135005
def list_health_monitors(self, retrieve_all=True, **_params):
        
        # Pass filters in "params" argument to do_request
        return self.list('health_monitors', self.health_monitors_path,
                         retrieve_all, **_params)
1021197
def info(self):
        

        return (self.start_pc, self.end_pc,
                self.handler_pc, self.get_catch_type())
49318
def devices(self):
        
        eax = self.attributes.get('devices')
        if eax is None:
            eax = self._all_devices
        if not isinstance(eax, list):
            eax = [eax]
        return [str(dev) for dev in eax]
435798
def _find_monitor(monitors, handle):
    """"""

    found_devs = set()
    found_events = set()

    for conn_string, device in monitors.items():
        for event, handles in device.items():
            if handle in handles:
                found_events.add(event)
                found_devs.add(conn_string)

    return found_devs, found_events