Skip to content

Commit 37509d4

Browse files
author
Josuah Demangeon
committed
usb: host: class: add a placeholder call after a device is connected
Add an ad-hoc placeholder that allows executing a function from the a single class, through a global variable defined in the USB class enabled. This does not allow several USB classes to co-exist so is not a long term solution and is meant to be replaced by a class API. Signed-off-by: Josuah Demangeon <[email protected]>
1 parent c57e82b commit 37509d4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

subsys/usb/host/usbh_core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ K_MSGQ_DEFINE(usbh_msgq, sizeof(struct uhc_event),
2929
K_MSGQ_DEFINE(usbh_bus_msgq, sizeof(struct uhc_event),
3030
CONFIG_USBH_MAX_UHC_MSG, sizeof(uint32_t));
3131

32+
extern const struct usbh_class_data *usbh_class_data;
33+
3234
static int usbh_event_carrier(const struct device *dev,
3335
const struct uhc_event *const event)
3436
{
@@ -70,6 +72,12 @@ static void dev_connected_handler(struct usbh_context *const ctx,
7072

7173
if (usbh_device_init(ctx->root)) {
7274
LOG_ERR("Failed to reset new USB device");
75+
return;
76+
}
77+
78+
if (usbh_class_data->connected(ctx)) {
79+
LOG_ERR("The class failed to handle the connection");
80+
return;
7381
}
7482
}
7583

0 commit comments

Comments
 (0)