add mount callback for device, move tests in mount callback
This commit is contained in:
@@ -660,6 +660,7 @@ static int usbh_enumerate(struct usbh_hubport *hport)
|
||||
}
|
||||
}
|
||||
|
||||
usbh_device_mount_done_callback(hport);
|
||||
errout:
|
||||
if (ret < 0) {
|
||||
usbh_hport_deactivate(hport);
|
||||
@@ -760,6 +761,7 @@ static void usbh_portchange_detect_thread(void *argument)
|
||||
}
|
||||
usbh_enumerate(hport);
|
||||
} else {
|
||||
usbh_device_unmount_done_callback(hport);
|
||||
usbh_hport_deactivate(hport);
|
||||
for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) {
|
||||
if (hport->config.intf[i].class_driver && hport->config.intf[i].class_driver->disconnect) {
|
||||
@@ -1027,3 +1029,11 @@ static const struct usbh_class_driver *usbh_find_class_driver(uint8_t class, uin
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__WEAK void usbh_device_mount_done_callback(struct usbh_hubport *hport)
|
||||
{
|
||||
}
|
||||
|
||||
__WEAK void usbh_device_unmount_done_callback(struct usbh_hubport *hport)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -68,12 +68,12 @@ enum usbh_event_type {
|
||||
};
|
||||
|
||||
struct usbh_class_info {
|
||||
uint8_t match_flags;/* Used for product specific matches; range is inclusive */
|
||||
uint8_t class; /* Base device class code */
|
||||
uint8_t subclass; /* Sub-class, depends on base class. Eg. */
|
||||
uint8_t protocol; /* Protocol, depends on base class. Eg. */
|
||||
uint16_t vid; /* Vendor ID (for vendor/product specific devices) */
|
||||
uint16_t pid; /* Product ID (for vendor/product specific devices) */
|
||||
uint8_t match_flags; /* Used for product specific matches; range is inclusive */
|
||||
uint8_t class; /* Base device class code */
|
||||
uint8_t subclass; /* Sub-class, depends on base class. Eg. */
|
||||
uint8_t protocol; /* Protocol, depends on base class. Eg. */
|
||||
uint16_t vid; /* Vendor ID (for vendor/product specific devices) */
|
||||
uint16_t pid; /* Product ID (for vendor/product specific devices) */
|
||||
const struct usbh_class_driver *class_driver;
|
||||
};
|
||||
|
||||
@@ -130,12 +130,12 @@ typedef struct usbh_hub {
|
||||
struct usbh_hubport *parent; /* Parent hub port */
|
||||
} usbh_hub_t;
|
||||
|
||||
void usbh_event_notify_handler(uint8_t event, uint8_t rhport);
|
||||
|
||||
int usbh_initialize(void);
|
||||
int lsusb(int argc, char **argv);
|
||||
struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr);
|
||||
void *usbh_find_class_instance(const char *devname);
|
||||
void usbh_device_mount_done_callback(struct usbh_hubport *hport);
|
||||
void usbh_device_unmount_done_callback(struct usbh_hubport *hport);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user