def command(self, cmd_code, cmd_data=None, timeout=100):
        cmd_name = self.CMD.get(cmd_code, "PN53x 0x{0:02X}".format(cmd_code))
        log.debug("{0} called with timeout {1} ms".format(cmd_name, timeout))
        
        if cmd_data is None: cmd_data = ""
        frame = bytearray([0xD4, cmd_code]) + bytearray(cmd_data)
        frame = bytearray([0xFF, 0x00, 0x00, 0x00, len(frame)]) + frame
        frame = bytearray([0x6B, len(frame)] + 8 * [0x00]) + frame

        self.transport.write(frame)
        frame = self.transport.read(timeout)
        
        if len(frame) < 14:
            strerror = os.strerror(errno.EIO) + " - Received frame too short"
            raise IOError(errno.EIO, strerror)
        if frame[0] != 0x83:
            strerror = os.strerror(errno.EIO) + " - Unexpected start of frame"
            raise IOError(errno.EIO, strerror)
        if frame[-2] == 0x63:
            strerror = os.strerror(errno.EIO) + " - No response from PN53X"
            raise IOError(errno.EIO, strerror)

        return frame[12:-2]
Send a chip command and return the chip response.
dataset/ETHPy150Open javgh/greenaddress-pos-tools/nfc/dev/acr122.py/Chipset.command