From what I remember, the fs_kill only deals with the stream handles... unless that has changed. While that would absolutely need to be done, so that streams are handled correctly, the readfile code is a "one shot" open, read, close. Does reset() call wrap_fat_kill and jswrap_fs_kill? Then, once the card is inserted again, you would have to call jsfsInit to get it back into operation.
after code inspection
At least, that is what it looks like from code inspection based on what is in github.
So, here is the test case, it looks like reset will kill all handles and unmount the card when it is pulled out. The second thing is to perform a reset after inserting the card... the reason is that reset also does initialization. Since the system does not auto detect insert and removal, you have to do it twice.
If this works, we would need E.mount to go with E.unmount in order to take full advantage of the hot swap as we are discussing. It looks like it should auto init on read after being unmounted, but I am wondering if that is not working for some reason (as in we are not doing enough to initialize the device, clearly we can initialize on startup).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
From what I remember, the fs_kill only deals with the stream handles... unless that has changed. While that would absolutely need to be done, so that streams are handled correctly, the readfile code is a "one shot" open, read, close. Does reset() call wrap_fat_kill and jswrap_fs_kill? Then, once the card is inserted again, you would have to call jsfsInit to get it back into operation.
after code inspection
At least, that is what it looks like from code inspection based on what is in github.
So, here is the test case, it looks like reset will kill all handles and unmount the card when it is pulled out. The second thing is to perform a reset after inserting the card... the reason is that reset also does initialization. Since the system does not auto detect insert and removal, you have to do it twice.
If this works, we would need E.mount to go with E.unmount in order to take full advantage of the hot swap as we are discussing. It looks like it should auto init on read after being unmounted, but I am wondering if that is not working for some reason (as in we are not doing enough to initialize the device, clearly we can initialize on startup).