alloc class name after the necessary commands are completed

This commit is contained in:
sakumisu
2022-05-22 17:09:47 +08:00
parent 16262f0575
commit 56364f2903
7 changed files with 61 additions and 28 deletions

View File

@@ -72,6 +72,10 @@ static int usbh_mtp_connect(struct usbh_hubport *hport, uint8_t intf)
}
}
strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN);
USB_LOG_INFO("Register MTP Class:%s\r\n", hport->config.intf[intf].devname);
return ret;
}
@@ -98,9 +102,10 @@ static int usbh_mtp_disconnect(struct usbh_hubport *hport, uint8_t intf)
usb_free(mtp_class);
USB_LOG_INFO("Unregister MTP Class:%s\r\n", hport->config.intf[intf].devname);
memset(hport->config.intf[intf].devname, 0, CONFIG_USBHOST_DEV_NAMELEN);
if (hport->config.intf[intf].devname[0] != '\0')
USB_LOG_INFO("Unregister MTP Class:%s\r\n", hport->config.intf[intf].devname);
memset(hport->config.intf[intf].devname, 0, CONFIG_USBHOST_DEV_NAMELEN);
hport->config.intf[intf].priv = NULL;
hport->config.intf[intf + 1].priv = NULL;
}