I am using the httpserver_raw from contrib with lwip 1.4.1 with no rtos. I am serving up web pages from the internal flash memory without any problems. This is the fsdata_custom.c file that is prepared using makefsdata. This all works fine.
However, I am struggling with the proper way to add support for an external file system, specifically SD card using FatFs. I have all the lower layers of FatFs working properly, I can read and open files using the FatFs APIs. I look at fs.c and I can see that I can create fs_open_custom and fs_close_custom. So far so good. But I do not have all the file in memory so I cant use the file->data, file->index to point to the current contents of the file. So now I think I want to use LWIP_HTTPS_DYNAMIC_FILE_READ. This is where I am getting stuck. First of all, there is no equivalent call to fs_read_custom() like there is fs_open_custom(). It looks like the only way to hook in my custom file read and write is by implementing fs_canread_custom() and fs_wait_read_custom() even though I was not planning to do asynchronous reads. I am not sure in this case what I am supposed to do in the functions fs_canread_custom() and fs_wait_read_custom() since neither of these takes any parameters like the buffer pointer and the count which is what I need to read from FatFs. I did go ahead and modify fs.c fs_read() function to read from FatFs the way I thought it should work, but I am still getting stuck on what I should set file->data and file->len to. When I look at httpd.c it looks like it still expects these to point at actual file data. It sets hs->file = to data field of fs_file. I also tried setting all these to 0, but then httpd.c calls fs_bytes_left() which returns 0 because len and index are 0. My next step will be to modify fs_bytes_left() to get bytes left from FatFs. My main question is, am I supposed to be able to cleanly hook in to fs.c in order to add SD card reading via FatFs, or is the expectation that I just need to make my own fs.c? I don't mind doing that, but since it looks like it already supports the concept of custom file I/O (fs_open_custom, etc) I thought there was already a defined way to do what I want, and I am worried I am missing something obvious. Thanks for reading. -joe k This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you.
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
