2009-11-09 07:51:55     wrong file name

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-11-09 07:51:55     wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82209   


Hi All,


When I try to do fopen for a track in a pen-drive mounted using VFAT fails with Errno=2 (File doesnot exist).


Track name whose fopen fails is displayed as,


in Windows --> "Andre Rieu - Sin título 10.pcm"


in Fedora 6 --> "Andre Rieu - Sin tÃlo 10.pcm"


I enabled NLS support in Kernel settings


Thanks in advance,






Andre Rieu - Sin título 10.pcm




2009-11-09 08:38:19     Re: wrong file name


Message: 82210   




What does the file look like when you mount it and type "ls"?



Please don't post file that you do not own, or have copyright permissions to do so.






2009-11-09 09:13:40     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82211   




Thanks for the info regarding file posting.


When I give "ls", trackname displayed is attached as a screenshot. Since if I copy the track name from terminal to this page, track name is displayed correctly.








2009-11-09 09:27:16     Re: wrong file name

Mike Frysinger (UNITED STATES)

Message: 82212   


you're probably seeing the string under go encoding conversion.  i highly doubt the C library code is broken here ... more likely you're pasting the wrong file name into the string you're putting into your source code.


it might be easier if you redirect the `ls` output to a file, transfer that to your development host, open that file in an editor, and copy & paste it to your source.  that might work better in preventing encoding conversions.




2009-11-09 09:35:12     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82213   




I use opendir and readdir to scan the drive to the file name, so I think this would have already avoid those encoding conversion issues




2009-11-09 09:49:26     Re: wrong file name

Mike Frysinger (UNITED STATES)

Message: 82214   


that should.  did you enable the right codepages (cp) in the kernel ?  simply enabling NLS support is not sufficient.  review the kernel log messages (i.e. `dmesg`).


does your code work under Fedora ?  what cp does Fedora use when mounting the device ?




2009-11-09 10:33:33     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82215   


Please find the attached dmesg after booting the kernel in which I enabled NLS.


My code is working fine in Fedora-6 (Linux host_120 2.6.18-1.2798.fc6)


I am not aware of how to find the code page when mounting. I am not sure if I enabled/ where to enable code page in kernel.


Please help. I checked the docs, but could not locate the relevant info.






2009-11-09 13:12:46     Re: wrong file name

Mike Frysinger (UNITED STATES)

Message: 82218   


that output doesnt show any mass storage device being detected let alone mounted.  if you build all the cp's as modules, then the kernel will automatically load it and you can see it in `lsmod`.


there isnt any documentation specific to this issue because it isnt specific to Blackfin in any way.  it operates the same under all Linux systems.


if you read the man page for `mount`, there are some vfat-specific mount options you could try like uni_xlate.




2009-11-10 03:55:40     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82249   


Please find the dmesg with storage device mount prints.


I built the kernel with cp for 437, 850, nls-utf8 as module. When I tried to mount the device with Codepage 850 and iocharset utf8, still my problem is not resolved.


In fedora, if I try to use the same command to mount, it is successful


mount /dev/sdc1 USB -o codepage=850,iocharset=utf8








2009-11-10 13:20:42     Re: wrong file name

Mike Frysinger (UNITED STATES)

Message: 82256   


your log is horribly mangled.  whatever terminal you're using sucks, and you really should get a good one.


run `ls /mnt/usb/ | hexdump -C` and post the output so i can see the exact bytes that are being used in the filename.


you might also want to compare this with your readdir/fopen code and print out the exact bytes that readdir finds to make sure it matches.




2009-11-12 04:52:36     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82306   


Please find the dump log,


root: /> mount -t vfat dev/sda1 mnt/usb -o codepage=850,iocharset=utf8


FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!


root: /> ls mnt/usb |hexdump -C


00000000  74 c3 ad 74 75 6c 6f 2e  70 63 6d 0a              |t..tulo.pcm.|




root: /> umount mnt/usb/


root: />


root: /> echo "Default mount configuration codepage=850 and iocharset = io8859-1"


Default mount configuration codepage=850 and iocharset = io8859-1


root: /> mount dev/sda1 mnt/usb/  


root: /> ls mnroot: /> ls mnt/uroot: /> ls mnt/usb/ |heroot: /> ls mnt/usb|hexdump -C


00000000  74 ed 74 75 6c 6f 2e 70  63 6d 0a                 |t.tulo.pcm.|




root: /> umount mnt/usb/


root: /> mount dev/sda1 mnt/usb


root: /> ls mnt/usb




root: />




2009-11-17 06:40:23     Re: wrong file name

Jayakumar Ananthakrishnan (INDIA)

Message: 82455   




Could you please let me know if you can make out anything from the dump?