Find the answer to your Linux question:
Results 1 to 4 of 4
Dear All I am new to linux at driver level, so please forgive me if this question had been asked earlier also. (I have searched this forum but did not ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    3

    SD CARD Read Write

    Dear All

    I am new to linux at driver level, so please forgive me if this question had been asked earlier also. (I have searched this forum but did not find my answer related thread).

    I want to read/write at specified memory location in microSD card in linux. I do not want to used SD card with any file system. So please guide me how to do that.

    My linux distribution is Fedora13.

    Please guide me.

    Regards
    Sachin

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Assuming that the sd card is recognized as /dev/sdb (it may be something else), then do this as root:
    Code:
    dd if=file-with-data-to-write of=/dev/sdb bs=1 seek=location-in-bytes
    You should bear in mind that you probably will need to make sure that the seek position starts on a device sector boundary.

    The Linux distribution you are using won't make any difference to this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jul 2009
    Posts
    3

    sd card access

    Thanks for your reply,

    I will try same. Please also let me know if there is any method to access SD card with "ioctl"

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by sachindelhi View Post
    Thanks for your reply,

    I will try same. Please also let me know if there is any method to access SD card with "ioctl"
    As I said in another posting today, ioctl() calls are incredibly specific to the OS, device type, device driver, etc. They are not intended to be portable. As to what ioctl() calls an SD card supports, it really depends. Not recommended for general programming use. There are more generalized ways to do what you want. IE, if you want to do what the dd command does, but in a C, C++, Java, or other program, then just open the block device for the card, seek to where you want to write the data, and then just write it using normal functions: open(), seek(), write(), close(), etc.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...