cmsis_dap: Always transfer 65 bytes with hid_read|write()

CMSIS-DAP Dragonprobe works on some devices. E.g. it does not work
on NUCLEO-F103
This commit is contained in:
Uwe Bonnes 2021-10-11 20:57:49 +02:00
parent b343ebe06f
commit 166eb3ee3e
2 changed files with 7 additions and 4 deletions

View File

@ -220,15 +220,18 @@ int dbg_dap_cmd(uint8_t *data, int size, int rsize)
DEBUG_WIRE("%02x.", buffer[i]);
DEBUG_WIRE("\n");
if (type == CMSIS_TYPE_HID) {
res = hid_write(handle, buffer, rsize + 1);
res = hid_write(handle, buffer, 65);
if (res < 0) {
DEBUG_WARN( "Error: %ls\n", hid_error(handle));
exit(-1);
}
res = hid_read(handle, buffer, report_size + 1);
res = hid_read_timeout(handle, buffer, 65, 1000);
if (res < 0) {
DEBUG_WARN( "debugger read(): %ls\n", hid_error(handle));
exit(-1);
} else if (res == 0) {
DEBUG_WARN( "timeout\n");
exit(-1);
}
} else if (type == CMSIS_TYPE_BULK) {
int transferred = 0;

View File

@ -197,10 +197,10 @@ void dap_connect(bool jtag)
//-----------------------------------------------------------------------------
void dap_disconnect(void)
{
uint8_t buf[1];
uint8_t buf[65];
buf[0] = ID_DAP_DISCONNECT;
dbg_dap_cmd(buf, sizeof(buf), 1);
dbg_dap_cmd(buf, sizeof(buf), 65);
}
static uint32_t swj_clock;