Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ezLCD hangs when powered up while enumerating USB #65

Open
JacobChrist opened this issue Mar 21, 2023 · 4 comments
Open

ezLCD hangs when powered up while enumerating USB #65

JacobChrist opened this issue Mar 21, 2023 · 4 comments
Assignees
Labels
API bug Something isn't working

Comments

@JacobChrist
Copy link
Member

Describe the bug
A clear and concise description of what the bug is.
When the ezLCD-5035 powers up via USB that is connected to a computer that causes the USB-MSD to enumerate this will result in one of two conditions:

  1. The Lua script hangs and does not recover.
  2. The Lua script hangs but recovers and continues after enumeration is complete.

Environment

  • Issue detected via: (Linux file browser open, Lua application running on ezLCD-5035)

To Reproduce
Steps to reproduce the behavior:

  1. Power ezLCD-5035 via USB that is connected to a computer.

Expected behavior
Lua script should not hang or lock up.

@microlan
Copy link
Contributor

What OS are you using to connect? Generally customers only use USB for initial programming and not in products. The issue is that USB and FatFS do not support any kind of locking method so there is no way to control if USB or FatFS "owns" the filesystem at any given time. Per my research, USB was never designed to support multiple connections to the same file system, so this kind of thing can be a problem if the OS accessing the USB port tries to access the filesystem while the EZLCD code is also accessing FatFS. The solution everyone came up with online for that was "don't do that--USB was not designed for that"

@microlan
Copy link
Contributor

NOTE that Windows 10 has no problem with this but Linux may be trying to access the filesystem and possibly trying to set the Dirty bit of the FAT filesystem while we are accessing it in FatFS. That cannot be supported in the core USB design of MSC unfortunately.

@JacobChrist
Copy link
Member Author

OS: Linux: 5.15.0-67-generic #74~20.04.1-Ubuntu

It would be a lot of work, but if we could create a fake MSD that the computer talks to that sits between the reals file system and USB this maybe a way around this. If customers are generally accepting of this issue then it could be closed, however, if I was using this product I would want the ability to not have this occur. Maybe another option would be to read an input and decide at startup if the device should dual enumerate as MSD + CDC-ACM or just CDC-ACM.

@JacobChrist
Copy link
Member Author

Started playing with button events in Lua.  Interestingly enough, when the program hangs as USB is enumerating the button events still work (I'm sending data out the serial port in the event).  So the Lua program is not 100% hung.  I'm running ezLCD-5035-032923.dfu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants