In which subdirectory of /proc is information about PC Cards, which are connected and recognised by a 2.6 kernel,stored?
-----------------------------------------------------
[root@cos3 /]# ll /proc/bus
total 0
dr-xr-xr-x 2 root root 0 Oct 20 05:26 input
dr-xr-xr-x 2 root root 0 Oct 20 05:26 pccard
dr-xr-xr-x 3 root root 0 Oct 20 05:26 pci
drwxr-xr-x 3 root root 0 Oct 19 19:33 usb
[root@cos3 /]# tree /proc/bus
/proc/bus
|-- input
| |-- devices
| `-- handlers
|-- pccard
| `-- drivers
|-- pci
| |-- 00
| | |-- 00.0
| | |-- 01.0
| | |-- 07.0
| | |-- 07.1
| | |-- 07.2
| | |-- 07.3
| | |-- 0f.0
| | |-- 10.0
| | |-- 11.0
| | |-- 12.0
| | `-- 13.0
| `-- devices
`-- usb
|-- 001
| `-- 001
`-- devices
6 directories, 17 files
----
为了实现设备的检测,系统会用到/proc目录,由于和尚的没有安装PCMCIA设备,所以上面的pccard/devices 是空文件。
给大家一个usb的例子。
[root@cos3 pccard]# cat /proc/bus/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.18-8.el5 uhci_hcd
S: Product=UHCI Host Controller
S: SerialNumber=0000:00:07.2
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms
你看到什么了?
和尚看到遥远的星空了。
没关系,在IBM的网站《如何在LINUX下实现硬件的自动检测》有详细解释。
我们再仔细看(中括号里是文件大小)
[root@cos3 bus]# tree -as
.
|-- [ 0] input
| |-- [ 0] devices
| `-- [ 0] handlers
|-- [ 0] pccard
| `-- [ 0] drivers
|-- [ 0] pci
| |-- [ 0] 00
| | |-- [ 256] 00.0
| | |-- [ 256] 01.0
| | |-- [ 256] 07.0
| | |-- [ 256] 07.1
| | |-- [ 256] 07.2
| | |-- [ 256] 07.3
| | |-- [ 256] 0f.0
| | |-- [ 256] 10.0
| | |-- [ 256] 11.0
| | |-- [ 256] 12.0
| | `-- [ 256] 13.0
| `-- [ 0] devices
`-- [ 0] usb
|-- [ 0] 001
| `-- [ 43] 001
`-- [ 0] devices
6 directories, 17 files
file size 是零哦,联想到 "Linux 虚拟文件系统" 了吗?
公布答案【/proc/bus/pccard】