HOWTO: Lector de targetes de memoria 6 en 1 (CF,MD,SD,MMC,SD,MS)

Contents:

1. Introducció

Objectiu 

Configurar un lector de targetes de memòria, en aquest cas el típic lector 6 en 1 que suporta: CompactFlash (CF), Micro Drive (MD), SmartMedia (SM), Multimedia Card (MC), Secure Digital (SD), Memmory Stick (MS).

En aquest cas el Hardware és el típic marca 'mira i no t'hi fixis' amb connexió USB 2.0 cap al PC. Segons el linux diu que la marca és: Standard Microsystems Corp. però a la caixa del fabricant no posa cap marca. La referència de producte és la SL21 per si el voleu buscar per internet.


Figure 1.1: Dispositiu 6 en 1 [frontal]

Fig. 1: 6 en 1


Figure 1.2: Dispositiu 6 en 1 [lateral]

Fig. 2: 6 en 1

2. Configuració

Configurant el Kernel 

Opcions del kernel que cal activar per tal de suportar el Hardware.

Code listing 2.1: Opcions a seleccionar al .config

#
# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives
#
CONFIG_BLK_DEV_IDESCSI=m

#
# SCSI device support
#
CONFIG_SCSI=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=m
CONFIG_CHR_DEV_SG=m

#
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
#
CONFIG_SCSI_MULTI_LUN=y

#
# USB support
#
CONFIG_USB=y

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
CONFIG_USB_BANDWIDTH=y
CONFIG_USB_DYNAMIC_MINORS=y

#
# USB Host Controller Drivers
#
CONFIG_USB_EHCI_HCD=m
# CONFIG_USB_OHCI_HCD is not set
CONFIG_USB_UHCI_HCD=m

#
# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
#
CONFIG_USB_STORAGE=m
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=y
CONFIG_USB_STORAGE_DPCM=y
CONFIG_USB_STORAGE_HP8200e=y
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_DEVFS_FS=y
CONFIG_DEVFS_MOUNT=y

Després de compilar i reiniciar el sistema amb el nou kernel. Carreguem els moduls necessaris, els moduls que hem de tenir funcionant després de fer el modprobe corresponent són:

Code listing 2.2

# lsmod
Module                  Size  Used by
usb_storage            64832  0 
ide_scsi               12420  0 
sg                     29984  0 
sd_mod                 13216  0 
ehci_hcd               36356  0 
uhci_hcd               30348  0 

Hardware ben configurat i detectat? 

Ara és el moment d'assegurar-nos que el que hem compilat al nou kernel funciona correctament. Si volem comprobar que tenim el dispositiu funcionant podem fer un lsusb:

Code listing 2.3

# lsusb -v
Bus 004 Device 002: ID 0424:20fc Standard Microsystems Corp. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 Interface
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0424 Standard Microsystems Corp.
  idProduct          0x20fc 
  bcdDevice            1.63
  iManufacturer           1 Generic
  iProduct                2 USB 2 Flash Media Device
  iSerial                 3 030702300782
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower               96mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize        512
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize        512
        bInterval               0
  unknown descriptor type: 07 21 07 e8 03 fe ff
  Language IDs: (length=4)
     0409 English(US)

...

Podem comprobar que el dispositiu esta funcionant. Per tant dins de /dev hi han d'haver els dispositius que hem configurat. En el nostre cas hi han d'haver 4 nous dispositius, perquè són les unitats que té un lector 6 en 1.

Code listing 2.4

# ls -la /dev/sd*
/dev/sda  /dev/sdb  /dev/sdc  /dev/sdd

/dev/sd:
c0b0t0u0  c0b0t0u1  c0b0t0u2  c0b0t0u3

Si fins aquí teniu tot això ja podem assegurar que ús funciona correctament el lector.

Treballant amb les noves unitats 

Ara col·loquem la nostre targete de memòria al slot corresponent del lector. Però malgrat els leds s'encenen correctament encara no podem montar la unitat perquè no veig les particions de la targeta. Que és el q podré montar al sistema. El petit 'trukillo' que jo uso és usar el fdisk, el que faig és el següent:

Code listing 2.5

Com que la targeta que hem posat és una SD que pertany a l'slot número 3, hem de localitzar el 3er dispositiu, o sigui, /dev/sdc.

# fdisk -l /dev/sdc
Disk /dev/sdc: 255 MB, 255066112 bytes
8 heads, 32 sectors/track, 1946 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1        1946      249069+   6  FAT16

Ens ha detectat una partició de tipus FAT16 la /dev/hdc1, si fem un ls a /dev podrem comprobar que ha aparegut un nou dispositiu que fa referència a aquest partició:

Code listing 2.6

# ls /dev/sd*
/dev/sda  /dev/sdb  /dev/sdc  /dev/sdc1  /dev/sdd

/dev/sd:
c0b0t0u0  c0b0t0u1  c0b0t0u2  c0b0t0u2p1  c0b0t0u3

Ara ja podem montar aquesta partició al nostre sistema de fitxers:

Code listing 2.7

# mkdir /mnt/flash
# mount /dev/sdc1 /mnt/flash
# df -h
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/sdc1             244M  4.8M  239M   2% /mnt/flash

Pos ja ta, ja teniu funcionant el 6 en 1.

Note: NO OBLIDEU DESMONTAR LA UNITAT ABANS D'EXTREURE LA TAREGETA: umount /mnt/flash



line
Updated 03 Març 2004
line
Oriol Rius
Autor

line
Summary: Com configurar un lector de targetes 6 en 1 amb un kernel 2.6.x
line
Questions, Comments, Corrections? Email oriol@joor.net.