-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fake filesystem or a pseudo-file for status information #8737
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
Comments
I feel like there could be some sort of safety issue with telling people to share a file that has that devices ip. |
It's the internal IP, inside the NAT, but in the filesystem case, there would be separate files. Giving your CircuitPython device an externally accessible IP address is already a security nightmare. |
I'm fond of the fake filesystem approach for these reasons:
|
@tannewt pointed out that the host OS will cache the file contents. We need to notify the host that it has changed. This may help: https://stackoverflow.com/questions/6775951/usb-mass-storage-device-side-data-changes-not-visible-on-pc-filesystem |
I like the idea a lot too, but there are some things to consider. First of all, while it would be nice to have this in ram, a well written app could just implement most if not all of this functionality in Secondly, if this is implemented, it should probably live after a vm exit, since it may have captured a Also, sidenote. If this works can't we do a similar hack to expose filesystem mounts (like sdcards) over usb-msc? The ip hardly ever changes, and catastrophic errors are worth the flash writes. |
I also like the idea of collecting traceback and potentially other debug info, particularly when the USB serial console is unavailable (battery projects, etc.) I think it should be non-volatile though, rather than RAM, so it persists across safe modes, or soft or hard resets, or unexpected losses of power. Related to #8704, #7490, and #1054. We have We have One of the things we don't have at all is information on what was executing last when there is a safe mode, reload, or reset, but no exception. It's particularly challenging for most users to store debug info from |
@anecdata it doesn't make much sense to make it non-volatile when it's going to be overwritten on the next boot anyways. And you run into flash wearing issues. |
Perhaps it would be interesting to have a rotating log-styled If the boots are identical and nothing errored out, no flash writes would occur. But that would require A LOT of code. |
perhaps there could be a setting to write all log outputs to a sd card so that the on board flash doesn't get worn down and it could be easier to check on logs that way |
This is a loose idea for now, but I will dump what we have so far, so it can be further discussed.
The crux is to have either a pseudo-file, or a whole fake filesystem on the CircuitPython's USB MSC disk, to make available dynamically-generated status information from the running CircuitPython.
It would replace the
boot_out.txt
file, but because it's not physically written to the flash and does not wear the flash storage or consume extra space on the device, it could contain a variety of additional information, such as the last exception traceback, the current IP address of the device, a URL for the web interface, even things like the contents of the NVRAM or amount of free memory.Personally, I'm particularly interested in putting the exception traceback in it, because that would greatly ease the support and debugging, without having to teach people how to use the serial console. We could simply ask them to upload the file, and we would have all the information we need for debugging: the exact version and the exception.
There are several ways we could go about implementing it. With the pseudo-file approach, we could have a file created, that points to some non-existent or reserved blocks for its content, and then have a special case for retrieving the contents of those blocks, generating them dynamically instead of reading them from the flash. With the filesystem approach, we could have a second partition in the partition table, and a whole fake filesystem, possibly with different files containing different pieces of information. In either case, the data would be read-only and dynamically generated.
Editors like Mu or Thonny, and plugins for IDEs could also check those files for status, errors and such.
The text was updated successfully, but these errors were encountered: