On 04/07/14 13:55, Itay Sali wrote: > > Does anyone have an example of writing text to file on usb storage. > > I am using DXE_DRIVER and shell is not relevant. > > I am trying to figure out how can I get the simple file protocol, then > open the volume and then open the file. > > I would appreciate if I can get cookbook for that or detailed example.
OVMF has USB support by including the following drivers: MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf For your use case, the first three, and the fifth, are relevant. - The first two depend on PciIo, and produce Usb2Hc (each separately). - The third depends on Usb2Hc, and produces UsbIo. - The fifth depends on UsbIo, and produces BlockIo. (All of the four relevant (cited) drivers are UEFI drivers.) When a USB disk is connected (see eg. <http://thread.gmane.org/gmane.comp.bios.tianocore.devel/4105/focus=4115>), the BlockIo-->DiskIo-->SimpleFileSystem (FAT) interfaces are (should be) created automatically. (I tested this now in OVMF.) I think that your DXE driver should - register a protocol notification callback for SimpleFileSystem (with gBS->RegisterProtocolNotify(), TPL_CALLBACK level), - in the callback function, locate the handles with the new SimpleFileSystem interfaces (gBS->LocateHandleBuffer() with ByRegisterNotify, in a loop), - for each handle, check the device path belonging to the handle (gBS->HandleProtocol(), or gBS->OpenProtocol() with GET_PROTOCOL), in order to see if (part of) the device path matches what you want, - if so, open the SimpleFileSystem interface of the handle, and use it. Laszlo ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees_APR _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
