MQX 4.2 Problem with finding a file on SDCard

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX 4.2 Problem with finding a file on SDCard

ソリューションへジャンプ
1,596件の閲覧回数
t_k
Contributor II

I was previously using MQX4.0 and my SDCard functions were all working fine.

We are trying to move to 4.2 and are finding a few issues we need to solve.

I need to be able to find a file on a SDCard, and the code used to work perfectly, but now it fails to find the file.

I'm able to create and write a separate file just fine after discovering not to flush the filesystem after writing.

Has the find file routine changed as well?

   MQX_FILE_PTR fs_ptr = NULL;

   char filepath[] = "b:\\file*.s19";

   MFS_SEARCH_DATA search_data;

   MFS_SEARCH_PARAM search;

   fs_ptr = _io_get_fs_by_name("b:");

   search.ATTRIBUTE = MFS_SEARCH_EXCLUSIVE;

   search.WILDCARD =  (char_ptr)&filepath;

   search.SEARCH_DATA_PTR = &search_data;

  

   if( ioctl( fs_ptr, IO_IOCTL_FIND_FIRST_FILE, (uint32_t *) & search ) == MFS_NO_ERROR )

   {

      DBG_INFO( "Upgrade files found, waiting 30s for upgrade request" );

   }

   else

   {

      DBG_INFO( "No upgrade files found" );

   }

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,300件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Travis,

MFS in MQX4.2 was widely reworked in compare MFS in MQX 4.1.1

I tested your code at MQX 4.2 for file search at USB flash disk and it works correctly on my side.

Just be careful: You selected MFS_SEARCH_EXCLUSIVE, therefore result file has to be without any attributes.

When I created file in shell by command “write test1 500”, result file was with attribute ARCHIVE.

If you don’t care about attributes, please use MFS_SEARCH_ANY as parameter for search.ATTRIBUTE.

Archive.png

Could you please specify closer your doubts about file search function?

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,300件の閲覧回数
t_k
Contributor II

you're right.  Changing from MFS_SEARCH_EXCLUSIVE to MFS_SEARCH_ANY fixed the problem.  Since it had worked in 4.0 and 4.1, I never expected it to need to be changed for 4.2.

thanks,

Travis

0 件の賞賛
返信
1,300件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Travis,

i am glad that it works now correctly.

Yes, it is possible that MFS in old version of MQX contained such bug and it was (unintentionally) fixed in reworked MFS code for MQX 4.2.

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
1,301件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Travis,

MFS in MQX4.2 was widely reworked in compare MFS in MQX 4.1.1

I tested your code at MQX 4.2 for file search at USB flash disk and it works correctly on my side.

Just be careful: You selected MFS_SEARCH_EXCLUSIVE, therefore result file has to be without any attributes.

When I created file in shell by command “write test1 500”, result file was with attribute ARCHIVE.

If you don’t care about attributes, please use MFS_SEARCH_ANY as parameter for search.ATTRIBUTE.

Archive.png

Could you please specify closer your doubts about file search function?

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信