Chan's FatFs 0.07e -->strcmp makes problems

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello

I have a mp3-player with this FatFs. After upgrading it to this latest version, my Player doesn't play anymore.
The reason is this part:

while (((res = f_readdir(&dirs, &Finfo)) == FR_OK) && Finfo.fname[0]) {                       if ( strcmp(&Finfo.fname[(strlen(Finfo.fname)-4)],".mp3")==0 ){	           play_file(Finfo.fname);
			}

It worked before. Of course sth. has changed in the FatFs-Structures. I checked the FILINFO-structure, but there is no difference between the fname-parts.

Do you guys have any idea, where the error could be?
Thanks and Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

strcmp in a ram cpu expects args in ram. strcmp in an avr might expect the structs that dont change to be in flash. In imagecraft there is a cstrcmp that takes args as 'c'onsts in flash. In gcc there is some hellacious awkward macro full of underbars that I have never been able to understand. What compiler does chan use? What compiler do you use?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

In gcc there is some hellacious awkward macro full of underbars that I have never been able to understand. What compiler does chan use? What compiler do you use?

Actually, you just append "_P" to the function name of the standard library functions for FLASH variants -- so "strcmp" becomes "strcmp_P". Yep, definitely hellalicious.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But it worked with the other FatFs-Version. Actually it was TinyFS, but the routines are nearly the same.
I have the GCC in AVR-Studio4.

update: no, strcmp_P doesn't work either
What a damn shit is this??? I mean the mp3-file is played, when i execute play_file(Finfo.fname); so the strcmp-function MUST work!
Totally confused...

Btw.: Why does the email notification for this forum doesn't work?

update2: i found a difference: in the old tff.h the structure had this name: _FILINFO
and the new ff.h: _FILINFO_

But what do I do with this information?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MasterBate wrote:
But it worked with the other FatFs-Version. Actually it was TinyFS, but the routines are nearly the same.
I have the GCC in AVR-Studio4.

update: no, strcmp_P doesn't work either
What a damn shit is this??? I mean the mp3-file is played, when i execute play_file(Finfo.fname); so the strcmp-function MUST work!
Totally confused...

Did you look at the revision history in FF.C?

In particular the filename returned from f_readdir() is now always in upper case - you only compare with the string ".mp3" so it won't match - just change it ".MP3".

kevin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh thank you man, not in 100 years this idea had crossed my mind!
Puh!