def __init__(self, device_id, corsair_sdk_dll_path, control=False): """ Create a new device object and check if it exists :param device_id: id of device :type device_id: int :param corsair_sdk_dll_path: Path to a sdk dll that matches the python version :type corsair_sdk_dll_path: str :param control: whether to request exclusive access or not :type control: bool """ super(Device, self).__init__(corsair_sdk_dll_path) self.device_id = device_id # Check if device exists self.device_info() if control: request_control(self.corsair_sdk, 0)
def request_control(self, device_id, access_mode=True): """ Request exclusive control of device :param device_id: id of device :type device_id: int :param access_mode: True=exclusive, False=shared :type access_mode: bool :returns: true if successful :rtype: bool """ if access_mode: if not request_control(self.corsair_sdk, device_id): self._raise_corsair_error() return True else: raise NotImplementedError