语言

Menu
Sites
Language
Reading external storage with Tizen 2.2

After upgrading to Tizen 2.2 I find myself unable to list the contents of the external storage (SD card). I'm using GetExternalStoragePath() to get the path, and a DirEnumerator to go through the files and directories.

I construct the enumerator, call ReadN, followed by a loop where I call MoveNext. On the first call to MoveNext I get an error like this:

ERROR / Tizen::Io ( 3114 : 3114 ) : result Tizen::Io::_DirEnumeratorImpl::MoveNext()(157) > [E_ILLEGAL_ACCESS] [SECURE_LOG] Failed to get attributes for directory entry (/opt/storage/sdcard//filename.ext), errno: 13 (Permission denied)

The same code was working fine with Tizen 2.1 and 2.2 beta. I can list the files on the external storage using sdb regardless of whether I'm in root mode or not. What has changed in 2.2 that would affect this? Is there some priviledge that I need to add to my app's manifest?

I'm running my app in the emulator using the emulimg-2.2.x86, if that matters.

 

 

 

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

8 回复
MooChang Kim
Hi. could you check owner of files that exist in the /opt/storage/sdcard/filename.ext ? if owner is 'root' then permission issue can happens. please check if you used 'sdb root on' command while pushing those files to sdcard. Regards
Ollanketo
Sure. The files on the SD card all belong to the root user and the root group. Without being root I can't push files to the SD card with sdb. The files do have read and write permissions for all users though (rw-rw-rw-).
MooChang Kim
I think this is a SDK bug.. other subfolders of '/opt/storage/sdcard' is okay. but only '/opt/storage/sdcard' folder is failed to push files. temporally, you can chnage permission of '/opt/storage/sdcard' to 'drwxr-xrwx' (+w for others) and try sdb push again without root permission. good luck.
Ollanketo
>>you can chnage permission of '/opt/storage/sdcard' to 'drwxr-xrwx' (+w for others) and try sdb push again without root I tried this. I was able to push the files this way, and the files are now shown as belonging to the developer user/group and having "rw-rw-rw-" permissions. But my app still gets the same "permission denied" error when trying to list the SD card contents (I've removed all the previous contents from the SD card, so the only files on it are the new ones that I pushed as the developer user).
MooChang Kim
could you check below command result in the target shell to check about permission more? "chsmack /opt/storage/sdcard/filename.ext" it shoud shows "system::ext_storage" for access label. "chsmack /opt/storage/sdcard" it shoud shows "system::ext_storage" for access label. and "transmute=TRUE"
Ollanketo
For the file I get access="sdbd". For the directory I get access="_". It doesn't say anything about transmute.
MooChang Kim
if 'tranmute' works well then access label of pushed file should be a 'system::ext_storage'. I think this is the issue.. and I guess there was some problem during you upgrade Tizen 2.2 from previous version.. could you reinstall 2.2 and retry?
Ollanketo
I finally got it working after uninstalling the Tizen SDK, reinstalling the SDK (2.2), giving write permission to everyone for /sdcard/ and pushing the files as a non-root user.