AnsweredAssumed Answered

MCF5225x MQX3.6 MFS IO_IOCTL_FIND_FIRST_FILE problem

Question asked by Angelo Quattrociocchi on Oct 8, 2013
Latest reply on May 29, 2014 by Garabo

I'm running MFS and USB host MSD stack to read files from a USB drive.  The drive is mounted fine and in the shell prompt I can enter dir and get a directory listing.  All the other MFS shell commands seem to work normally as well.  But I also have some code that attempts to get the first file from the directory but it returns -1.  The code is essentially the same as the example given in the MFS user guide (rev2.2, page 32), so I'm not sure what's wrong.  I also don't recognize that error code (-1).  I would expected an error to be positive and in the 0x3000 range.

 

_mqx_int error_code;

MFS_SEARCH_DATA search_data;

MFS_SEARCH_PARAM search;

char filepath[] = “*.*”;

 

search.ATTRIBUTE = MFS_SEARCH_ANY;

search.WILDCARD = filepath;

search.SEARCH_DATA_PTR = &search_data;

error_code = ioctl(mfs_fd_ptr, IO_IOCTL_FIND_FIRST_FILE,(uint_32_ptr) &search);

 

while (error_code == MFS_NO_ERROR) {

     printf ("%-12.12s\n", search_data.NAME);

     error_code = ioctl(mfs_fd_ptr, IO_IOCTL_FIND_NEXT_FILE, (uint_32_ptr) &search_data);

} else {

     printf ("error code %d\n", error_code);

}

 

Output:

error code -1

 

 

Any advice on what might be the problem, or what I could try to fix it?

 

Thank you

Outcomes