def __init__(self, stick, data, offset = 0):
        data = pyhsm.util.input_validate_str(data, 'data', max_len = pyhsm.defines.YSM_DATA_BUF_SIZE)
        self.data_len = len(data)
        self.offset = pyhsm.util.input_validate_int(offset, 'offset', pyhsm.defines.YSM_DATA_BUF_SIZE - 1)
        # typedef struct {
        #   uint8_t offs;                       // Offset in buffer. Zero flushes/resets buffer first
        #   uint8_t numBytes;                   // Number of bytes to load
        #   uint8_t data[YSM_DATA_BUF_SIZE];    // Data to load
        # } YSM_BUFFER_LOAD_REQ;
        fmt = "B B %is" % self.data_len
        packed = struct.pack(fmt, self.offset, self.data_len, data)
        YHSM_Cmd.__init__(self, stick, pyhsm.defines.YSM_BUFFER_LOAD, packed)
dataset/ETHPy150Open Yubico/python-pyhsm/pyhsm/buffer_cmd.py/YHSM_Cmd_Buffer_Load.__init__/original