-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tusb_msc): Add device mount/unmount callback #122
base: master
Are you sure you want to change the base?
Conversation
5815978
to
4230c66
Compare
I added a user callback which gets called at There is a new event
There are 3 events now,
Just to make sure, which event is registered to storage mount and which to device mount. So we will have something like this:
But those event enums are used in tusb_msc example So we will be changing some publicly accessible enums. Also What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter-marcisovsky thank you for this clean-up effort.
However, I think that if we want to refactor the tud_mount_cb()
handling we should do it at the device level, not in the MSC class, like it is done now.
@roma-jam Could we include this in our esp_tinyusb 2.0.0 plans?
void tud_umount_cb(void) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tud_umount_cb
and tud_mount_cb
are TinyUSB callbacks for the whole device. So they should not be defined at class level, but at device level (eg. in tinyusb.c)
Yes, maybe it is even worth a discussion regarding the implementation of tud_mount_cb() within the esp_tinyusb. |
Description
This MR adds a possibility to define a user callback for device mount/unmount events.
Right now, the
tusb_msc_storage.c
automatically calls:tinyusb_msc_storage_mount()
attud_umount_cb()
tinyusb_msc_storage_unmount()
attud_mount_cb()
User has no flexibility to do anything else upon the device mount/unmount.
This MR adds a flexibility to the user, to for example control an owership of the storage (eg, not to automatically unmount a storage when a USB device is plugged in)
Also cleaned conceptions between device mount/unmount and storage mount/unmount, not to confuse anyone when the code refers to device mount/unmount and when to storage mount/unmount.
Related
Related to #78
Testing
Checklist
Before submitting a Pull Request, please ensure the following: