# SPDX-License-Identifier: MIT import struct from ..utils import * from .asc import StandardASC from .asc.base import * SMC_READ_KEY = 0x10 SMC_WRITE_KEY = 0x11 SMC_GET_KEY_BY_INDEX = 0x12 SMC_GET_KEY_INFO = 0x13 SMC_INITIALIZE = 0x17 SMC_NOTIFICATION = 0x18 SMC_RW_KEY = 0x20 class SMCMessage(Register64): TYPE = 7, 0 UNK = 11, 8, Constant(0) ID = 15, 12 class SMCInitialize(SMCMessage): TYPE = 7, 0, Constant(SMC_INITIALIZE) class SMCGetKeyInfo(SMCMessage): TYPE = 7, 0, Constant(SMC_GET_KEY_INFO) KEY = 63, 32 class SMCGetKeyByIndex(SMCMessage): TYPE = 7, 0, Constant(SMC_GET_KEY_BY_INDEX) INDEX = 63, 32 class SMCWriteKey(SMCMessage): TYPE = 7, 0, Constant(SMC_WRITE_KEY) SIZE = 23, 16 KEY = 63, 32 class SMCReadKey(SMCMessage): TYPE = 7, 0, Constant(SMC_READ_KEY) SIZE = 23, 16 KEY = 63, 32 class SMCReadWriteKey(SMCMessage): TYPE = 7, 0, Constant(SMC_RW_KEY) RSIZE = 23, 16 WSIZE = 31, 24 KEY = 63, 32 class SMCResult(Register64): RESULT = 7, 0 ID = 15, 12 SIZE = 31, 16 VALUE = 63, 32 class SMCError(Exception): pass class SMCEndpoint(ASCBaseEndpoint): BASE_MESSAGE = SMCMessage SHORT = "smcep" TYPE_MAP = { "ui64": ("I", self.read(key, 4))[0] def write64(self, key, data): self.write(key, struct.pack("