(self)
return response
Save current config to the mouse internal memory.
Save current config to the mouse internal memory.
Save current config to the mouse internal memory .
def save(self):
        """Save current config to the mouse internal memory."""
        # This should never happen... But who knows...
        if (
            "save_command" not in self.mouse_profile
            or not self.mouse_profile["save_command"]
        ):
            raise Exception("This mouse does not provide any save command.")

        packet_length = 0
        if "packet_length" in self.mouse_profile["save_command"]:
            packet_length = self.mouse_profile["save_command"]["packet_length"]

        self._hid_write(
            report_type=self.mouse_profile["save_command"]["report_type"],
            data=self.mouse_profile["save_command"]["command"],
            packet_length=packet_length,
        )

        response = None
        if (
            "readback_length" in self.mouse_profile["save_command"]
            and self.mouse_profile["save_command"]["readback_length"]
        ):
            response = self._hid_device.read(
                self.mouse_profile["save_command"]["readback_length"],
                timeout_ms=200,
            )

        self.mouse_settings.save()

        return response
def save ( self ) : # This should never happen... But who knows... if ( "save_command" not in self . mouse_profile or not self . mouse_profile [ "save_command" ] ) : raise Exception ( "This mouse does not provide any save command." ) packet_length = 0 if "packet_length" in self . mouse_profile [ "save_command" ] : packet_length = self . mouse_profile [ "save_command" ] [ "packet_length" ] self . _hid_write ( report_type = self . mouse_profile [ "save_command" ] [ "report_type" ] , data = self . mouse_profile [ "save_command" ] [ "command" ] , packet_length = packet_length , ) response = None if ( "readback_length" in self . mouse_profile [ "save_command" ] and self . mouse_profile [ "save_command" ] [ "readback_length" ] ) : response = self . _hid_device . read ( self . mouse_profile [ "save_command" ] [ "readback_length" ] , timeout_ms = 200 , ) self . mouse_settings . save ( ) return response