Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_12v_ocp_mode(self):
"""Get +12V single/multi-rail OCP mode."""
return OCPMode(self._exec(WriteBit.READ, _CORSAIR_12V_OCP_MODE)[2])
def initialize(self, single_12v_ocp=False, **kwargs):
"""Initialize the device.
Necessary to receive non-zero value responses from the device.
Note: replies before calling this function appear to follow the
pattern <address> .
"""
self._write([0xfe, 0x03]) # not well understood
self._read()
mode = OCPMode.SINGLE_RAIL if single_12v_ocp else OCPMode.MULTI_RAIL
if mode != self._get_12v_ocp_mode():
# TODO replace log level with info once this has been confimed to work
LOGGER.warning('(experimental feature) changing +12V OCP mode to %s', mode)
self._exec(WriteBit.WRITE, _CORSAIR_12V_OCP_MODE, [mode.value])
if self._get_fan_control_mode() != FanControlMode.HARDWARE:
LOGGER.info('resetting fan control to hardware mode')
self._set_fan_control_mode(FanControlMode.HARDWARE)
self.device.release()
</address>