normally fgets is on a buffered FILE handle. For AP_Filesystem we use
an unbuffered file descriptor. This means we were reading one byte at
a time from the file
this uses lseek to make fgets() much more efficient by reading the max
buffer size at a time in the file
Improves safety of use and clarity of users. Termination is not
included in the reported size to avoid changing user behavior or
misrepresenting the file contents.
Adds virtual directory entries for these virtual filesystems in /
RTL> ftp list
RTL> Listing /
D @MISSION
D @PARAM
D @ROMFS
D @SYS
D APM
D log
V5_BT.dfu 10541
bootlog.txt 297
dataman 350216
message-intervals-chan0.txt 7
Total size 352.60 kByte
ftp list @MISSION
RTL> Listing @MISSION
LIST: OP seq:7 sess:2 opcode:129 req_opcode:3 size:2 bc:0 ofs:0 plen=2 [2]
ftp list @ROMFS
RTL> Listing @ROMFS
bootloader.bin 16448
hwdef.dat 5743
io_firmware.bin 40880
Total size 61.59 kByte
This PR also makes us *much* more lenient in what we accept for looking at virtual filesystems, so
ftp list @SYS
ftp list /@SYS
ftp list @SYS/
ftp list /@SYS/
should all work
these are causing some boards to crash on startup. Tested with a
QiotekZealotH743 which doesn't get out of setup_usb_strings()
once we have debugged this we can re-add the functionality
vast numbers of these otherwise:
/home/pbarker/gcc/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: lib/libArduCopter_libs.a(liolib.c.0.o): in function `read_all':
liolib.c:(.text.read_all+0x20): undefined reference to `apfs_fread'
/home/pbarker/gcc/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: lib/libArduCopter_libs.a(liolib.c.0.o): in function `read_line':
liolib.c:(.text.read_line+0x24): undefined reference to `apfs_getc'
/home/pbarker/gcc/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: lib/libArduCopter_libs.a(liolib.c.0.o): in function `io_fclose':
liolib.c:(.text.io_fclose+0xe): undefined reference to `apfs_fclose'
/home/pbarker/gcc/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: lib/libArduCopter_libs.a(liolib.c.0.o): in function `io_open':
The actual filesize of the parameter downloadfile is around
15200 bytes. The indicated filesize is used in QGC for the
progressbar. This patch does not try to compute the exact filesize
but I try a better estimate. Only the full download off all
parameters is considered to avoid more complexity.