cherry-embedded / CherryUSB

CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB IP

Home Page:https://cherryusb.cherry-embedded.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lsusb的-t命令会出现空指针异常

flyranchao opened this issue · comments

        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);
						}
					}
                }
            }
        }
    }

不需要增加,如果没有class driver,必须不准使用