修复BUG

This commit is contained in:
HEYAHONG 2024-04-04 16:32:33 +08:00
parent cf4de3c520
commit 53b6a7db5d
No known key found for this signature in database
GPG Key ID: 97E3E469FE2C920B

View File

@ -4,7 +4,7 @@
#include "libusb.h"
#include "Version.h"
#include "string"
#include "string.h"
#include "string.h"
#include "vector"
#ifndef LIBUSB_API_VERSION
@ -185,6 +185,7 @@ int main(int argc,const char *argv[])
if(info.bus_number == usb_bus)
{
uint8_t core_port_path[8] = {0};
size_t core_port_path_length=0;
memcpy(core_port_path,info.port_path,sizeof(info.port_path));
for(size_t i =0 ; i < sizeof(core_port_path); i++)
@ -193,11 +194,12 @@ int main(int argc,const char *argv[])
{
//Core连接到端口2
core_port_path[i]=2;
core_port_path_length=i+2;
break;
}
}
if(memcmp(core_port_path,usb_port_path,sizeof(core_port_path)) == 0)
if(core_port_path_length > 0 && memcmp(core_port_path,usb_port_path,core_port_path_length) == 0)
{
//Core连接到USB如需对Core进行操作,可在此处打开usb_device
info.core_is_use_usb=true;