Example #1
0
    def detect_ac(self):
        if self.DEBUG:
            devices = ', '.join(power.get_devices(power.DeviceType.MAINS))
            log.debug('AC: %s', devices if devices else 'none detected')

        if not power.is_online(self.config['linux']['ac_file']):
            self.kill_the_system('AC')
Example #2
0
    def detect_battery(self):
        if self.DEBUG:
            devices = ', '.join(power.get_devices(power.DeviceType.BATTERY))
            log.debug('Battery: %s', devices if devices else 'none detected')

        try:
            if not power.is_present(self.config['linux']['battery_file']):
                self.kill_the_system('Battery')
        except FileNotFoundError:
            pass