【发布时间】:2019-02-01 10:52:30
【问题描述】:
我正在与Cypress FX3 kit 设备通信。
我使用以下方式发送信息:
unsigned int file_size;
unsigned short wLength = 16;
unsigned int timeout = 1000;
unsigned short wValue = 0, wIndex = 1;
/* Here I get my file_size value */
file_size = 4000; // For the sake of the example.
rStatus = libusb_control_transfer(
device_handle, /* a handle for the device to communicate with */
WRITE_REQUEST_TYPE, /* bmRequestType: the request type field for the setup packet */
VND_CMD_SLAVESER_CFGLOAD, /* bRequest: the request field for the setup packet */
wValue, /* wValue: the value field for the setup packet */
wIndex, /* wIndex: the index field for the setup packet */
(unsigned char *) &file_size, /* *data: a suitably-sized data buffer */
wLength, /* wLength: the length field for the setup packet. The data buffer should be at least this size. */
timeout); /* timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0. */
现在我的程序正在获取正确的信息。我将 UART 消息发送到我的计算机,并且确实 FX3 固件正在获取所需的内容并继续执行所需的内容,但是 cpp 程序从不退出libusb_control_transfer 函数。
至少超时不应该阻止这个函数永远不会返回吗?或者如果它没有阻止它,因为它能够发送数据......它是否在等待 FX3 固件不发送的 ACK?我不知道如何调试。
在某些情况下,我还会在libusb_control_transfer 中找到Process finished with exit code 139 (interrupted by signal 11: SIGSEGV).(我打印出来检查它确实在里面)。
【问题讨论】:
标签: libusb libusb-1.0