lsusb的-t命令会出现空指针异常
flyranchao opened this issue · comments
flyranchao commented
for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {
hport = &hub->child[port];
if (hport->connected) {
for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) {
if(hport->config.intf[i].class_driver != NULL) { //建议这里加上判空处理。
if (hport->config.intf[i].class_driver->driver_name) {
USB_LOG_RAW(" |__Port %u,Port addr:0x%02x,If %u,ClassDriver=%s\r\n",
hport->port,
hport->dev_addr,
i,
hport->config.intf[i].class_driver->driver_name);
}
}
}
}
}
}
sakumisu commented
不需要增加,如果没有class driver,必须不准使用