Read and write blocks of SD card from userspace

Hello All,

I'm trying to access a SD card using low level read/write functions (without file system, cache, etc...).

I have a custom SD card that can be lock/unlock using a custom command. To activate/execute these commands, the application need to read and write in specials locations (with special data).
Assuming this, I already develop an application in Windows and Linux with success. For Linux, while I use a SD Reader, I can implement some USB Mass Storage Class commands in userspace application (to avoid the whole file system).

Until now, everything is OK. However, If the SD card is connected directly (without the USB SD reader), the same approach cannot be applied.

For example, I'm using a Wandboard (iMX6 ARM with native SD support) and I get the same results (not success).

When I try to use mmc-utils, the call ioctl get "Connection timed out".

Using the following methods doesn't work:

- open/read/write functions (c/c++)
- open/read/write functions (c/c++) with O_DIRECT flag
- open/read/write functions (c/c++) with O_DIRECT flag and flush operations

Any suggestions will be appreciated.

Thanks
Hello all,
I get working WRITE and READ commands directly to the SD using the current driver and IOCTL calls. I was missing some MMC parameters on the IOCTL calls.
Thanks,
Julio
Topic archived. No new replies allowed.