EHCI Mass storage device problems on real hardware
Posted: Wed Jul 29, 2020 3:01 pm
Hello,
I have been working on a mass storage device driver for ehci for a while now.
The idea is to run it on my emulator (qemu) and on real hardware.
The system detects the class of the attached device on real hardware and on the emulator.
Also the function of selecting a configuration works.
Getting the max lun works aswell which is on real hardware and on the emulator 0.
The things that are not working comes at this point.
I start with issuing the command "inquiry" via the scsi protocol.
Here the first strange things are happening.
The first thing is that on the emulator, I need to send the command via endpoint 2 and then recieve it at endpoint 1.
At real hardware, this causes a "halt" error unless I send and recieve data on endpoint 1.
The second problem is that according to the specifications of the mass storage devices for usb, you should wait for the controll block to be recieved.
On emulator this works perfectly but on real hardware it keeps waiting forever (more then 5 seconds and then my software issues a timeout).
The third problem was when I tried to load a sector from the device. qemu somehow only sends data in chunks of 144 bytes of data while real hardware uses the full 512 bytes at once.
The fourth problem was that when I read the first sector (0) then the emulator makes the sector end with 0x55 0xAA like I expected but on real hardware it returns different things and it does not look like anything I expect at all.
This is the code for the stick:
https://github.com/AdeRegt/SanderOSUSB/ ... ci_stick.c
This is the code for EHCI:
https://github.com/AdeRegt/SanderOSUSB/ ... dev/ehci.c
I hope someone can help.
Thank you in advantage
I have been working on a mass storage device driver for ehci for a while now.
The idea is to run it on my emulator (qemu) and on real hardware.
The system detects the class of the attached device on real hardware and on the emulator.
Also the function of selecting a configuration works.
Getting the max lun works aswell which is on real hardware and on the emulator 0.
The things that are not working comes at this point.
I start with issuing the command "inquiry" via the scsi protocol.
Here the first strange things are happening.
The first thing is that on the emulator, I need to send the command via endpoint 2 and then recieve it at endpoint 1.
At real hardware, this causes a "halt" error unless I send and recieve data on endpoint 1.
The second problem is that according to the specifications of the mass storage devices for usb, you should wait for the controll block to be recieved.
On emulator this works perfectly but on real hardware it keeps waiting forever (more then 5 seconds and then my software issues a timeout).
The third problem was when I tried to load a sector from the device. qemu somehow only sends data in chunks of 144 bytes of data while real hardware uses the full 512 bytes at once.
The fourth problem was that when I read the first sector (0) then the emulator makes the sector end with 0x55 0xAA like I expected but on real hardware it returns different things and it does not look like anything I expect at all.
This is the code for the stick:
https://github.com/AdeRegt/SanderOSUSB/ ... ci_stick.c
This is the code for EHCI:
https://github.com/AdeRegt/SanderOSUSB/ ... dev/ehci.c
I hope someone can help.
Thank you in advantage