def dapInfo(self, id_):
        cmd = []
        cmd.append(COMMAND_ID['DAP_INFO'])
        cmd.append(ID_INFO[id_])
        self.interface.write(cmd)

        resp = self.interface.read()
        if resp[0] != COMMAND_ID['DAP_INFO']:
            raise ValueError('DAP_INFO response error')

        if resp[1] == 0:
            return

        # Integer values
        if id_ in ('CAPABILITIES', 'PACKET_COUNT', 'PACKET_SIZE'):
            if resp[1] == 1:
                return resp[2]
            if resp[1] == 2:
                return (resp[3] << 8) | resp[2]

        # String values
        x = array.array('B', [i for i in resp[2:2+resp[1]]])

        return x.tostring()
dataset/ETHPy150Open geky/pyDAPLink/pyDAPLink/daplink/protocol.py/CMSIS_DAP.dapInfo/original