file: linux_cardread-6.2.html
16 Jul 2003

Linux FLASH Card Reading Instructions for RedHat 6.x

Setup:  Toshiba 4000CDT notebook PC; 
             Dual Boot Win98 and RH Linux 6.0

      (Note: also tested OK on Dell Inspiron 5000 and Dell Inspiron 8100
             with RH Linux 6.2)

Note 1: An Intel PCMCIA FLASH card will be recognized on boot up.
        To see what was recognized in the PCMCIA slots, do a:

        cat /var/run/stab

Note 2: To avoid any confusion among cards, only install the
        PCMCIA FLASH card.  Leave the other PCMCIA slot empty.

*******************************************************************

PROCEDURES:

EITHER DO THESE STEPS THE FIRST TIME:

1> Put the PCMCIA card into the top slot and boot to Linux.

2> Hopefully you heard a couple of "happy" (higher pitch) beeps
   as the PCMCIA cardmgr messages went by on the screen.

3> do a:

        cat /var/run/stab

   to see which slot the card is in; on my Toshiba and the Dells, the top slot
   is 1, so I'll use 1 in the rest of this write-up;  

OR

1> If Linux is already running, put the PCMCIA card into the slot
   (use this same slot consistently) and listen for a couple of beeps.
   If you just get an error message and no beeps, try:

   cardctl insert 1

   (or if you're not sure what slot the card is in, try:  cardctl insert 0)

   If still nothing:

        Did you plug the card in???

	Did you set up /etc/pcmcia/config for this type of memory card per the
        new pcmcia setup info?

        If you did, and it's not recognized, try rebooting as above;
        And if that doesn't work, but other PCMCIA cards (modem, 
        ethernet, SCSI or whatever) do work (you DID try this, right?)
        - I'm stuck......

        Oh, well.....


*******************************************************************

ALL THE USEFUL INCANTATIONS:

Primary assumption:  the card is recognized and something appears in
/var/run/stab, such as:

        Socket 0: 3Com 3c589D Ethernet
        0	network	3c589_cs	0	eth0
        Socket 1: Intel Series 2+ 20MB Flash
        1	memory	memory_cs	0	mem0	126	0
        1	ftl	ftl_cs	0	ftl0c0	127	0

or:

        Socket 0: 3Com 3c589D Ethernet
        0	network	3c589_cs	0	eth0
        Socket 1: Anonymous Memory
        1	memory	memory_cs	0	mem0	126	0



***********  IMPORTANT NOTE - IGNORE AT YOUR PERIL!!!  *************

IMPORTANT NOTE:  The first version of /var/run/stab above is what you
will see after a PCMCIA card is installed.  The Intel FLASH card is ready
to read to a file.  The second version (Anonymous Memory) is what you get
after installing a card that's not fully recognized - it's not quite ready
to rock & roll yet.  In this case, you should have heard a "sad" beep
followed by a "happy" beep.  OR, if the card is not recognized at all, you
probably got just a "sad beep.  In either of these last cases, DO THIS NOW:

cardctl eject 1

You should have heard a "happy" beep...

   NOW REMOVE THE CARD!!

and setup per the instructions in new pcmcia setup info.

On completion, re-insert the card. This time, you should have heard 2 "happy"
beeps as the card is automatically recognized; now try:

cat /var/run/stab

you should now see something like the first /var/run/stab above.

In general, once you've got Linux running, you should NOT need to manually
(i.e. with "carcctl") insert/eject to get the card fully recognized,
 
*************  END OF VERY IMPORTANT NOTE ****************

SO:

To read a PCMCIA memory card
 -  just insert it into a PCMCIA slot;
(and there had better be 2 happy beeps after that insert...)

------------------------------------------------------------

To remove a PCMCIA memory card
 - just eject it from the slot 
(there should be a single beep as the card is removed)

------------------------------------------------------------

To see if the card is recognized in the slot:

cardctl status

------------------------------------------------------------

To see if the cardmgr recognizes the card:

cat /var/run/stab

------------------------------------------------------------

To copy the entire card to a file:

cp /dev/mem0c0c your_filename

------------------------------------------------------------

NOTE: This is the preferred way to read a FLASH card to a file!

To copy part of the card to a file, where blocksize=1024 bytes and count=number of blocks to copy (e.g. to copy 2 MB of a 20 MB card) and skip bypasses the first 128K reserved space in the FLASH card: dd bs=1024 count=2048 skip=128 if=/dev/mem0c0c of=your_filename ------------------------------------------------------------ To view the binary as hex: od -t x1 -A x your_filename | less

- Use arrow keys, page-up/down, 'q' to quit ------------------------------------------------------------ For more command info, see the man pages for: cardctl cardmgr dd od ------------------------------------------------------------ geek note: For completeness, here's how to get at the CIS in attribute memory (I'll assume a 4k CIS - probably way too big): dd bs=1024 count=4 if=/dev/mem0a of=your_CIS_filename ------------------------------------------------------------