MFS provides an ioctl function for getting the long filename of a file. There are several problems:
1. The documentation (MQXMFSUG 2.6 section 3.8.1.24) describes IO_IOCTL_GET_LFN and says "The third parameter is the char_ptr to the path name of the of file which we want
the long filename of". This is not true. The third parameter is not a pointer to char, it is a pointer to a struct of type MFS_GET_LFN_STRUCT. The function prototype and example code are correct, but the text description is wrong.
2. MFS_GET_LFN_STRUCT, which you provide to ioctl(IO_IOCTL_GET_LFN) has three fields:
typedef struct mfs_get_lfn_struct {
char_ptr PATHNAME;
char_ptr LONG_FILENAME;
MFS_SEARCH_DATA_PTR SEARCH_DATA_PTR;
} MFS_GET_LFN_STRUCT, _PTR_ MFS_GET_LFN_STRUCT_PTR;
The intended operation appears to be that you fill in PATHNAME with the short path name, call ioctl(IO_IOCTL_GET_LFN) and it fills in LONG_FILENAME. The third field, SEARCH_DATA_PTR, is unused.
The problem comes when you call ioctl(IO_IOCTL_GET_LFN) and pass it an MFS_GET_LFN_STRUCT that has been created for you by calling ioctl(IO_IOCTL_FIND_NEXT_FILE). This is a fairly obvious workflow and is used for example in _io_mfs_dir_read(). The problem is twofold:
You can easily see this issue, for example on a K60 tower using the shell "dir" command in the stock example application. Create files on an SD card with the following directory structure using a PC, put the card in the tower, then use the shell dir command. Look carefully at the long filename for the file in the subdirectory; it's wrong.
This is not the fault of the Shell_dir() command. It is caused by the underlying _io_mfs_dir_read() as described above.
Solved! Go to Solution.
Thank you very much for your bug report.
You are right, work with long names is currently uneffective (it is too slow for more files with long names) and it has to be reworked.
Reported bug will be fixed on one of next MQX releases.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you very much for your bug report.
You are right, work with long names is currently uneffective (it is too slow for more files with long names) and it has to be reworked.
Reported bug will be fixed on one of next MQX releases.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
This bug was fixed in which MQX Release?
Could i apply a patch in MQX version 4.1.1 to fix this?
Best Regards,
Rui Faria
Hi Rui,
MFS was reworked in MQX 4.2.0. So, MQX version 4.1.1 still contains this bug.
Unfortunately I am afraid that there isn’t any specific patch for MQX version 4.1.1.
I would like to recommend use latest version MQX 4.2.0 and apply also patch MQX 4.2.0.1 Software Patch for fix some of issues in MQX 4.2.0. Optionally you could try importing just new MFS into your MQX 4.1.1.
Best Regards
RadekS