Handling PCMCIA/CF cards in Linux

I do not like a way how PCMCIA/CF cards are handled under Linux. For kernels < 2.6.13-rc1 the only choice is pcmcia-cs package with lot of files in /etc/pcmcia/ which are just cardctl ident output edited a bit with added driver name:

root@c7x0:~# cardctl ident
Socket 0:
  product info: "Pretec", "CompactWLAN Card 802.11b", "2.5"
  manfid: 0x0156, 0x0002
  function: 6 (network)
root@c7x0:~# tail -n4 /etc/pcmcia/hostap_cs.conf
card "Pretec WLAN"
  version "Pretec", "CompactWLAN Card 802.11b", "2.5"
  manfid 0x0156, 0x0002
  bind "hostap_cs"
root@c7x0:~#

With newer kernels we have two options:

  • stick with pcmcia-cs and it’s configs
  • use new pcmciautils and udev rules

Pcmciautils way is nice — no extra daemon running, cards are handled as hotpluggable — everything looks nice and clear… But there is something other — list of devices handled by driver is in driver itself — so if you get card which is not there then you have to provide patch for it (like I already did for some cards) or try module aliases.

But both methods has one nasty thing — no way to tell ‘this card HAS to use THIS driver NOT that’ ;( This situation is common for Prism2 based WiFi cards which can be used with orinoco_cs driver (will appear as eth0) or with hostap_cs driver (appear as wlan0). For example my Pretec card (ident shown above) is handled by both drivers but only HostAP give me possibility to connect to my home network which use WPA-PSK for security (Orinoco does not support WPA at all). And all because some manufacturers was to lazy to change manfid/prodid of card from the one which reference card had…