My MSD driver now works perfectly in QEMU, but I can not get it to work on real hardware. My source code is available on
https://github.com/Klaykap/BleskOS/blob/master/source/drivers/usb_ehci.asm and
https://github.com/Klaykap/BleskOS/blob/master/source/drivers/usb_mass_storage.asm . On real hardware every transfer with endpoint 0 is good, so I can set address of device, read device descriptor and device qualifier. Problem comes when I want to send first OUT packet - Command Block Wrapper for Inquiry command. On real hardware is this command PINGed(status of transfer descriptor is 0x01) and every other transfer, no matter if IN or OUT, stuck on active status(0x80). Please where can be the problem?
How my driver work:
1. EHCI controller is initalized by method init_ehci
2. Method ehci_detect_devices is scanning all EHCI ports
3. Method ehci_detect_device is dealing with one port. If is device founded, this method call ehci_set_address and ehci_device_read_descriptor.
4. ehci_device_read_descriptor found type of device. If it is MSD, it save controller base, port, out and in endpoint. After it is called ehci_msd_descriptor. To this point all work on both QEMU and real computer. Here is called method msd_init
5. msd_init tries to send Inquiry command, but it never happend on real computer because TD status is 0x01.