コード例 #1
0
    def set_status_led(self, color):
        """
        Set system LED status based on the color type passed in the argument.
        Argument: Color to be set
        Returns:
          bool: True is specified color is set, Otherwise return False
        """

        if color not in list(self.SYSLED_COLOR_TO_REG.keys()):
            return False

        val = hwaccess.pci_get_value(self.pci_res, self.sysled_offset)
        val = (val & 0xFFCF) | self.SYSLED_COLOR_TO_REG[color]

        hwaccess.pci_set_value(self.pci_res, val, self.sysled_offset)
        self.sys_ledcolor = color
        return True
コード例 #2
0
    def set_status_led(self, color):
        """
        Sets the state of the system LED
        Args:
            color: A string representing the color with which to set the
                   system LED
        Returns:
            bool: True if system LED state is set successfully, False if not
        """
        if color not in list(self.SYSLED_COLOR_TO_REG.keys()):
            return False

        val = pci_get_value(self.pci_res, self.sysled_offset)
        val = (val & 0xFFCF) | self.SYSLED_COLOR_TO_REG[color]

        pci_set_value(self.pci_res, val, self.sysled_offset)
        self.sys_ledcolor = color
        return True
コード例 #3
0
 def set_locator_led(self, color):
     """
     Sets the state of the Chassis Locator LED
     Args:
         color: A string representing the color with which to set the Chassis Locator LED
     Returns:
         bool: True if the Chassis Locator LED state is set successfully, False if not
     """
     resource = "/sys/bus/pci/devices/0000:04:00.0/resource0"
     val = pci_get_value(resource, SYSTEM_LED_REG)
     if  self.LOCATOR_LED_ON == color:
         val = int(val) | SYSTEM_BEACON_LED_SET
     elif self.LOCATOR_LED_OFF == color:
         val = int(val) & SYSTEM_BEACON_LED_CLEAR
     else:
         return False
     pci_set_value(resource, val, SYSTEM_LED_REG)
     return True
コード例 #4
0
    def set_locator_led(self, color):
        """
        Sets the state of the Chassis Locator LED

        Args:
            color: A string representing the color with which to set the Chassis Locator LED

        Returns:
            bool: True if the Chassis Locator LED state is set successfully, False if not

        """
        val = hwaccess.pci_get_value(PCI_RES, SYSTEM_LED_REG)
        if self.LOCATOR_LED_ON == color:
            val = int(val) | SYSTEM_BEACON_LED_SET
        elif self.LOCATOR_LED_OFF == color:
            val = int(val) & SYSTEM_BEACON_LED_CLEAR
        else:
            return False
        hwaccess.pci_set_value(PCI_RES, val, SYSTEM_LED_REG)
        return True