bouffalolab / bouffalo_sdk

BouffaloSDK is the IOT and MCU software development kit provided by the Bouffalo Lab Team, supports all the series of Bouffalo chips. Also it is the combination of bl_mcu_sdk and bl_iot_sdk
Apache License 2.0
362 stars 128 forks source link

BL808 examples/peripherals/usbhost demo在没有接鼠标时崩溃,上电接鼠标正常,但是中途拔插鼠标就会崩溃。 #56

Closed c-hamster closed 1 year ago

c-hamster commented 1 year ago

如题,崩溃位置在这个地方。第一次接触cherryusb 。

void usbh_find_class_instance(const char devname) { struct usbh_hubport hport; usb_slist_t hub_list; usb_slist_for_each(hub_list, &hub_class_head) ---------------此处第二次循环出错 崩溃 {
struct usbh_hub *hub = usb_slist_entry(hub_list, struct usbh_hub, list); for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {

        hport = &hub->child[port];
        printf("port=%d hub->hub_desc.bNbrPorts=%d connect=%d\r\n",port, hub->hub_desc.bNbrPorts,hport->connected);
        if (hport->connected) {
            for (uint8_t itf = 0; itf < hport->config.config_desc.bNumInterfaces; itf++) {
                if ((strncmp(hport->config.intf[itf].devname, devname, CONFIG_USBHOST_DEV_NAMELEN) == 0) && hport->config.intf[itf].priv)
                    return hport->config.intf[itf].priv;
            }
        }
    }
}
return NULL;

}

sakumisu commented 1 year ago

测试没有问题,自己解决吧

c-hamster commented 1 year ago

你发的邮件我已经收到!谢谢!