about the MFS LFN problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

about the MFS LFN problem

Jump to solution
1,105 Views
fukefeng
Contributor III

I use the MFS on the usb storage device,if you just use the short file name,you can find the file names soon,and if you want find the long file names,it takes too long times.eg.there are about 100 or 200 files in the current. maybe i use the api in wrong way

Labels (1)
Tags (3)
0 Kudos
1 Solution
715 Views
zhiyangzhang
Contributor III

Maybe you can refer to this https://community.freescale.com/thread/309151. I just encountered the same problem and resolved it in the end. Some efficient method should be used to satisfy your demand.  The difference is that I read from SD card which does not matter.

View solution in original post

0 Kudos
6 Replies
715 Views
fukefeng
Contributor III

K70 device, MQX4.0

0 Kudos
716 Views
zhiyangzhang
Contributor III

Maybe you can refer to this https://community.freescale.com/thread/309151. I just encountered the same problem and resolved it in the end. Some efficient method should be used to satisfy your demand.  The difference is that I read from SD card which does not matter.

0 Kudos
715 Views
fukefeng
Contributor III

Thank you, I used the mathod you which you provided,now it work well.

0 Kudos
715 Views
zhiyangzhang
Contributor III

You are welcome. Best Regards!

0 Kudos
715 Views
fukefeng
Contributor III

if((search_data.ATTRIBUTE & MFS_ATTR_DIR_NAME) == MFS_ATTR_DIR_NAME) {

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

     continue;

}


0 Kudos
715 Views
fukefeng
Contributor III

I use the api in this way:

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

while (error_code == MFS_NO_ERROR) {

     lfn_struct.PATHNAME = search_data.NAME;

     error_code = ioctl(HS_USBFS_HANDLE, IO_IOCTL_GET_LFN, (uint_32_ptr) &lfn_struct);

     if((search_data.ATTRIBUTE & MFS_ATTR_DIR_NAME) == MFS_ATTR_DIR_NAME)     continue;

     if(0 != strcmp(".\0",  (char *)&search_data.NAME))

     if(error_code == MFS_NO_ERROR)

          strcpy(ListPtr2[ListPtrNum2], lfn);

     else

          strcpy(ListPtr2[ListPtrNum2], search_data.NAME);

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

}

thanks for answer me!

0 Kudos