}
dap->packet_size = packet_size;
- dap->packet_buffer_size = packet_size + REPORT_ID_SIZE;
+ dap->packet_buffer_size = packet_size;
dap->bdata->usb_ctx = ctx;
dap->bdata->dev_handle = dev_handle;
dap->bdata->ep_out = ep_out;
return ERROR_FAIL;
}
+ dap->command = dap->packet_buffer;
+ dap->response = dap->packet_buffer;
+
return ERROR_OK;
}
/* skip the first byte that is only used by the HID backend */
err = libusb_bulk_transfer(dap->bdata->dev_handle, dap->bdata->ep_out,
- dap->packet_buffer + REPORT_ID_SIZE, txlen - REPORT_ID_SIZE, &transferred, timeout_ms);
+ dap->packet_buffer, txlen, &transferred, timeout_ms);
if (err) {
if (err == LIBUSB_ERROR_TIMEOUT) {
return ERROR_TIMEOUT_REACHED;
static int cmsis_dap_usb_alloc(struct cmsis_dap *dap, unsigned int pkt_sz)
{
- unsigned int packet_buffer_size = pkt_sz + REPORT_ID_SIZE;
- uint8_t *buf = malloc(packet_buffer_size);
+ uint8_t *buf = malloc(pkt_sz);
if (buf == NULL) {
LOG_ERROR("unable to allocate CMSIS-DAP packet buffer");
return ERROR_FAIL;
dap->packet_buffer = buf;
dap->packet_size = pkt_sz;
- dap->packet_buffer_size = packet_buffer_size;
+ dap->packet_buffer_size = pkt_sz;
+
+ dap->command = dap->packet_buffer;
+ dap->response = dap->packet_buffer;
return ERROR_OK;
}