mirror of
https://github.com/HEYAHONG/ExtBoard-001.git
synced 2025-05-08 23:52:38 +08:00
添加对USB设备地址的打印
This commit is contained in:
parent
7ff7190a55
commit
a797e277bb
@ -29,8 +29,13 @@ int main(int argc,const char *argv[])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int usb_bus=0,usb_dev=0;
|
||||
if(SP_OK != sp_get_port_usb_bus_address(port,&usb_bus,&usb_dev))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Found USB SerialPort(%04X:%04X) %s\n",vid,pid,sp_get_port_name(port));
|
||||
printf("Found USB(%d-%d) SerialPort(%04X:%04X) %s\n",usb_bus,usb_dev,vid,pid,sp_get_port_name(port));
|
||||
|
||||
//判断DAPLink的VID与PID
|
||||
if(vid==0x0D28 && pid == 0x0204)
|
||||
|
@ -15,6 +15,7 @@
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bus_number;//ExtBoard-001所在的usb总线号
|
||||
uint8_t core_dev_address;//Core设备地址(USB)
|
||||
uint8_t port_path[8];//ExtBoard-001所在的usb总线路径,即USB Hub芯片连接的端口
|
||||
bool core_is_use_usb;//ExtBoard-001是否使用usb总线
|
||||
} extboard_001_info_t;
|
||||
@ -202,6 +203,7 @@ int main(int argc,const char *argv[])
|
||||
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_dev_address=libusb_get_device_address(usb_device);
|
||||
info.core_is_use_usb=true;
|
||||
}
|
||||
}
|
||||
@ -244,6 +246,10 @@ int main(int argc,const char *argv[])
|
||||
}
|
||||
printf("\n");
|
||||
printf("\tcore is use usb:%s\n",info.core_is_use_usb?"true":"false");
|
||||
if(info.core_is_use_usb)
|
||||
{
|
||||
printf("\tcore usb dev address:\t%d\n",(int)info.core_dev_address);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user