How to use the liquidctl.driver.usb.UsbHidDriver function in liquidctl

To help you get started, we’ve selected a few liquidctl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonasmalacofilho / liquidctl / liquidctl / driver / seasonic.py View on Github external
from liquidctl.driver.usb import UsbHidDriver
from liquidctl.pmbus import CommandCode as CMD
from liquidctl.pmbus import linear_to_float

LOGGER = logging.getLogger(__name__)

_READ_LENGTH = 64
_WRITE_LENGTH = 64
_MIN_DELAY = 0.0025
_READ_ATTEMPTS = 3

_SEASONIC_READ_FIRMWARE_VERSION = CMD.MFR_SPECIFIC_FC
_RAILS = ['+12V #1', '+12V #2', '+12V #3', '+5V', '+3.3V']


class SeasonicEDriver(UsbHidDriver):
    """liquidctl driver for Seasonic E-series PSUs."""

    SUPPORTED_DEVICES = [
        (0x7793, 0x5911, None, 'NZXT E500 (experimental)', {}),
        (0x7793, 0x5912, None, 'NZXT E650 (experimental)', {}),
        (0x7793, 0x2500, None, 'NZXT E850 (experimental)', {}),
    ]

    def initialize(self, **kwargs):
        """Initialize the device.

        Aparently not required.
        """
        pass

    def get_status(self, **kwargs):
github jonasmalacofilho / liquidctl / liquidctl / driver / nzxt_smart_device.py View on Github external
LOGGER = logging.getLogger(__name__)

_ANIMATION_SPEEDS = {
    'slowest':  0x0,
    'slower':   0x1,
    'normal':   0x2,
    'faster':   0x3,
    'fastest':  0x4,
}

_MIN_DUTY = 0
_MAX_DUTY = 100


class CommonSmartDeviceDriver(UsbHidDriver):
    """Common functions of Smart Device and Grid drivers."""

    def __init__(self, device, description, speed_channels, color_channels, **kwargs):
        """Instantiate a driver with a device handle."""
        super().__init__(device, description)
        self._speed_channels = speed_channels
        self._color_channels = color_channels

    def set_color(self, channel, mode, colors, speed='normal', **kwargs):
        """Set the color mode.

        Only available for the Smart Device V1/V2.
        """
        if not self._color_channels:
            raise NotImplementedError()
        cid = self._color_channels[channel]
github jonasmalacofilho / liquidctl / liquidctl / driver / kraken_two.py View on Github external
'backwards-super-wave':          (0x0d, 0x10, 0x00, 1, 8, True),  # independent ring leds
}
_ANIMATION_SPEEDS = {
    'slowest':  0x0,
    'slower':   0x1,
    'normal':   0x2,
    'faster':   0x3,
    'fastest':  0x4,
}
_READ_ENDPOINT = 0x81
_READ_LENGTH = 64
_WRITE_ENDPOINT = 0x1
_WRITE_LENGTH = 65


class KrakenTwoDriver(UsbHidDriver):
    """liquidctl driver for third generation NZXT Kraken X and M liquid coolers."""

    DEVICE_KRAKENX = 'Kraken X'
    DEVICE_KRAKENM = 'Kraken M'
    SUPPORTED_DEVICES = [
        (0x1e71, 0x170e, None, 'NZXT Kraken X (X42, X52, X62 or X72)', {
            'device_type': DEVICE_KRAKENX
        }),
        (0x1e71, 0x1715, None, 'NZXT Kraken M22', {
            'device_type': DEVICE_KRAKENM
        }),
    ]

    def __init__(self, device, description, device_type=DEVICE_KRAKENX, **kwargs):
        super().__init__(device, description)
        self.device_type = device_type
github jonasmalacofilho / liquidctl / liquidctl / driver / corsair_hid_psu.py View on Github external
MULTI_RAIL = 0x2

    def __str__(self):
        return self.name.capitalize().replace('_', ' ')

class FanControlMode(Enum):
    """Fan control mode."""

    HARDWARE = 0x0
    SOFTWARE = 0x1

    def __str__(self):
        return self.name.capitalize()


class CorsairHidPsuDriver(UsbHidDriver):
    """liquidctl driver for Corsair HID PSUs."""

    SUPPORTED_DEVICES = [
        (0x1b1c, 0x1c05, None, 'Corsair HX750i (experimental)', {}),
        (0x1b1c, 0x1c06, None, 'Corsair HX850i (experimental)', {}),
        (0x1b1c, 0x1c07, None, 'Corsair HX1000i (experimental)', {}),
        (0x1b1c, 0x1c08, None, 'Corsair HX1200i (experimental)', {}),
        (0x1b1c, 0x1c0a, None, 'Corsair RM650i (experimental)', {}),
        (0x1b1c, 0x1c0b, None, 'Corsair RM750i (experimental)', {}),
        (0x1b1c, 0x1c0c, None, 'Corsair RM850i (experimental)', {}),
        (0x1b1c, 0x1c0d, None, 'Corsair RM1000i (experimental)', {}),
    ]

    def initialize(self, single_12v_ocp=False, **kwargs):
        """Initialize the device.