请教自制cmsis-dap的vid pid必须是特定的吗?
自制的cmsis-dap调试器,使用的pid vid必须是特定的吗?如果不是,那keil和uar怎么能检测到cmsis-dap调试器? 因为cmsis-dap枚举成通用的hid设备 不一定。看上位机情况。上位机可以用PID/VID白名单,也可以看设备名。插一段openocd识别CMSIS-DAP的代码
/*
* The CMSIS-DAP specification stipulates:
* "The Product String must contain "CMSIS-DAP" somewhere in the string. This is used by the
* debuggers to identify a CMSIS-DAP compliant Debug Unit that is connected to a host computer."
*/
devs = hid_enumerate(0x0, 0x0);
cur_dev = devs;
while (cur_dev) {
bool found = false;
if (vids == 0) {
if (!cur_dev->product_string) {
LOG_DEBUG("Cannot read product string of device 0x%x:0x%x",
cur_dev->vendor_id, cur_dev->product_id);
} else if (wcsstr(cur_dev->product_string, L"CMSIS-DAP")) {
/* if the user hasn't specified VID:PID *and*
* product string contains "CMSIS-DAP", pick it
*/
found = true;
}
} else {
/* otherwise, exhaustively compare against all VID:PID in list */
for (i = 0; vids || pids; i++) {
if ((vids == cur_dev->vendor_id) && (pids == cur_dev->product_id))
found = true;
}
}
iamseer 发表于 2024-1-31 05:46
不一定。看上位机情况。上位机可以用PID/VID白名单,也可以看设备名。
插一段openocd识别CMSIS-DAP的代码
(引用自2楼)
这代码看上去是识别的字符串描述 就是识别的描述符里面的字符串的
页:
[1]