Linux 下使用 PCMCIA 设备
Linux 对 PCMCIA 设备提供了很好的支持。本文简单介绍了Linux下PCMCIA设备的安装方法。
Linux 支持 PCMCIA 设备的内核模块名为 pcmcia_core,我们可以使用 lsmod
命令来确认该模块是否已经加载:
# lsmod | grep pcmcia_core
pcmcia_core 59913 3 yenta_socket,orinoco_cs,ds
监视 PCMCIA 设备状态的服务进程叫做 cardmgr,我们可以通过 ps 命令确认它已启动:
# ps -fC cardmgr
UID PID PPID C STIME TTY TIME CMD
root 1946 1 0 19:43 ? 00:00:00 /sbin/cardmgr
通过 PCMCIA 的启动脚本 /etc/init.d/pcmcia 也能获知 PCMCIA 监视进程的状态:
# /etc/init.d/pcmcia status
cardmgr (pid 1946) is running...
该进程启动时,从 /etc/pcmcia/config 中获取系统安装的 PCMCIA 设备所对应的内核模块并将其加载,然后随时监视 PCMCIA 设备的状态。
控制 PCMCIA 设备的命令为 cardctl,它的格式如下:
# cardctl
usage: cardctl command [socket #]
or cardctl [-c configpath] [-f scheme] [-s stab] scheme [name]
commands: status config ident info suspend resume reset eject insert
各个命令的功能如下:
- status: 显示 PCMCIA 设备的状态。
- ident: 显示 PCMCIA 设备的识别信息。
- suspend: 停止 PCMCIA 设备。
- resume: 恢复 PCMCIA 设备。
- eject: 弹出指定的设备。
- insert: 插入指定的设备。
例如:
[root@toshiba pcmcia]# cardctl status
Socket 0:
3.3V 16-bit PC Card
function 0: [ready]
Socket 1:
no card
Socket 2:
no card
[root@toshiba pcmcia]# cardctl ident
Socket 0:
product info: "TOSHIBA", "Wireless LAN Card", "Version 01.01", ""
manfid: 0x0156, 0x0002
function: 6 (network)
Socket 1:
no product info available
Socket 2:
no product info available
[root@toshiba pcmcia]# cardctl eject 0
[root@toshiba pcmcia]# cardctl status
Socket 0:
no card
Socket 1:
no card
Socket 2:
no card
[root@toshiba pcmcia]# cardctl insert 0
[root@toshiba pcmcia]# cardctl status
Socket 0:
3.3V 16-bit PC Card
function 0: [ready]
Socket 1:
no card
Socket 2:
no card