USB ROM Driver - Detect Attach and Removal

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by emh203 on Wed Nov 19 12:28:36 MST 2014
Is there a clean way to determine when a USB device is attached or removed with the USB rom drivers?   I am currently using MSC.    I need to be able detect when the enumeration process is complete and when the device is disconnected to be able to provide some mutual exclusion when accessing the SD card.

The dirty way to do it is monitor VBUS on an IO pin but I was hoping to there was a way through the ROM drivers.    I am pretty sure I can get what I want by adding code to a custom interrupt handler but I wanted to see if there were callbacks available for this function.