Author Topic: CF card works in camera, unreadable on computer.  (Read 257 times)

kopruch

  • New to the forum
  • *
  • Posts: 9
CF card works in camera, unreadable on computer.
« on: November 02, 2017, 01:16:16 PM »
Hello everyone!

I've got a problem with a CF card. For some reason it works in camera (5Dmk3), but the computer can't see it.
There are MLVs on it, I can even view them in-camera and record new ones, but not download them.

Here is what I've already done:
- Use 3 different USB 3.0 readers, including Lexar - doesn't help. Asks to Initialize every time.
- Use Initialize and OSX recovery - it tries to recover partition map, but fails. It sees 128GB card as... 33MB partition.
- Use PhotoRec - same as above - 33MB partition with nothing on it to recover.
- Use TestDisk - also 33MB partition, "No partition found or selected for recovery".

After all that experiments I've tried on 5Dmk3 again - and everything is still there.

Any thoughts?
Thanks in advance!
A.Kozlowski

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5760
Re: CF card works in camera, unreadable on computer.
« Reply #1 on: November 02, 2017, 01:30:06 PM »
Use another computer/OS. Some OS X versions are known to have compatibility issues with ExFAT.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10439
  • 5D Mark Free
Re: CF card works in camera, unreadable on computer.
« Reply #2 on: November 02, 2017, 01:42:06 PM »
If it works in the camera, load file_man.mo and copy the files to the SD card, then use the SD reader to transfer the files to PC. It's good to have a backup copy during this kind of data recovery experiments.

kopruch

  • New to the forum
  • *
  • Posts: 9
Re: CF card works in camera, unreadable on computer.
« Reply #3 on: November 02, 2017, 01:53:04 PM »
Thanks for the fast reply and a great idea, a1ex :)

The only problem left that is left is that I have accidentaly deleted one of the MLVs from the camera, so I hoped I can get the access to the card from computer and use Photorec or Wondershare (both worked last time I have deleted files). Can Magic Lantern somehow rebuild the partition, if it can see and normally use the card?

And, by the way, thanks for the Magic Lantern - I'm using it for last few years and I think you have changed the industry :)

Walter - I will try with a PC - maybe that will help.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10439
  • 5D Mark Free
Re: CF card works in camera, unreadable on computer.
« Reply #4 on: November 02, 2017, 02:12:16 PM »
If your SD card is larger than CF, I already have a dd-like utility to create a CF image and save it to SD as a regular file.

State is unknown, it was written many months ago for my own use (had a similar issue and did not have a CF reader with me). It's hardcoded for 5D3.

Code: [Select]
#include <module.h>
#include <dryos.h>
#include <bmp.h>
#include <menu.h>
#include <console.h>

struct cf_device
{
    /* type b always reads from raw sectors */
    int (*read_block)(
        struct cf_device * dev,
        void * buf,
        uintptr_t block,
        size_t num_blocks
    );

    int (*write_block)(
        struct cf_device * dev,
        const void * buf,
        uintptr_t block,
        size_t num_blocks
    );
};

static void copy_cf_sd_task()
{
    console_show();
   
    extern struct cf_device ** cf_device_ptr[];
    struct cf_device * const dev = cf_device_ptr[0][4];
    if (!dev) return;

    FILE* f = FIO_CreateFile("B:/cf.img");
    if (!f) return;
   
    uint8_t *buf = fio_malloc(512 * 32768);
    if (!buf) return;
   
    int read = 0;
    int start = 0;
    while (read = dev->read_block(dev, buf, start, 32768))
    {
        printf("Read %d blocks from %d (%s)\n", read, start, format_memory_size((start + read) * 512ll));
        FIO_WriteFile(f, buf, 512 * read);
        start += read;
    }
   
    FIO_CloseFile(f);
}

static struct menu_entry dd_menu[] = {
    {
        .name       = "Copy CF image to SD",
        .select     = run_in_separate_task,
        .priv       = copy_cf_sd_task,
    },
};

static unsigned int dd_init()
{
    menu_add("Debug", dd_menu, COUNT(dd_menu));
   
    return 0;
}

static unsigned int dd_deinit()
{
    return 0;
}

MODULE_INFO_START()
    MODULE_INIT(dd_init)
    MODULE_DEINIT(dd_deinit)
MODULE_INFO_END()

This should help getting started; otherwise I'll give it a try later (and maybe commit it if people find it useful).