From cfb8d3bcdb4b1c4e5e153111e0502ec354512377 Mon Sep 17 00:00:00 2001 From: Zhihong Chen Date: Wed, 19 Aug 2026 12:55:23 +0800 Subject: [update] platform: zephyr: add MSC application lifecycle hooks - Add weak usbh_msc_app_run() and usbh_msc_app_stop() callbacks to the Zephyr MSC disk adapter. - Invoke the application start callback after registering the disk and the stop callback before unregistering it, allowing samples to mount and unmount filesystems without modifying the CherryUSB class driver. Signed-off-by: Zhihong Chen --- platform/zephyr/usbh_msc_disk.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/platform/zephyr/usbh_msc_disk.c b/platform/zephyr/usbh_msc_disk.c index 6890f985..0223a9ee 100644 --- a/platform/zephyr/usbh_msc_disk.c +++ b/platform/zephyr/usbh_msc_disk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, sakumisu + * Copyright (c) 2025-2026 sakumisu * * SPDX-License-Identifier: Apache-2.0 */ @@ -131,12 +131,26 @@ static struct disk_info usbh_msc_disk = { .ops = &msc_disk_ops, }; +__WEAK void usbh_msc_app_run(struct usbh_msc *msc_class) +{ + (void)msc_class; +} + +__WEAK void usbh_msc_app_stop(struct usbh_msc *msc_class) +{ + (void)msc_class; +} + void usbh_msc_run(struct usbh_msc *msc_class) { disk_access_register(&usbh_msc_disk); + + usbh_msc_app_run(msc_class); } void usbh_msc_stop(struct usbh_msc *msc_class) { + usbh_msc_app_stop(msc_class); + disk_access_unregister(&usbh_msc_disk); -} \ No newline at end of file +} -- cgit v1.3.1