I am using a Domino to collect data which I write to the SD card. This works fine.
What I want to do is to be able to copy the contents of my SD card to the USB thumb drive when I plug it in. I have used the examples in the Beginners guide but have the following problems:
The SD card remains in the device. I do not want to remove it. When the device boots it is found by the RemovableMedia.Insert event. I print out the files (to debug) and all is OK.
When I plug the USB drive in the USBHostController.DeviceConnectedEvent event runs. Note that the RemovableMedia.Insert event does NOT run in this case.
In the USBHostController.DeviceConnectedEvent I instantiate a new PersistentStorage(device), which is declared as a static global, and mount the file system. What I am stuck on is how to associate the USB drive to a MediaEventArgs instance if the RemovableMedia.Insert event does not run. It appears that I need this to be able to access the files. I am confused as to the relationship between the PersistentStorage instances and access to the file systems.
If both devices are plugged in at boot time then both are discovered in RemovableMedia.Insert events and both file systems are read properly.