In Linux various special files can be found under the directory /dev. These files are called device files and behave unlike ordinary files. The most common types of device files are for block devices and character devices. These files are an interface to the actual driver (part of the Linux kernel) which in turn accesses the hardware. Another, less common, type of device file is the named pipe. The most important device files are listed in the tables below.
fd0 |
第一個軟碟機 |
fd1 |
第二個軟碟機 |
hda |
在第一個 IDE 埠(Master)的 IDE 硬碟/光碟機 |
hdb |
在第一個 IDE 埠(Slave)的 IDE 硬碟/光碟機 |
hdc |
在第二個 IDE 埠(Master)的 IDE 硬碟/光碟機 |
hdd |
在第二個 IDE 埠(Slave)的 IDE 硬碟/光碟機 |
hda1 |
在第一塊 IDE 硬碟上的第一個分割區 |
hdd15 |
在第四塊 IDE 硬碟上的第十五個分割區 |
sda |
SCSI ID 最小(例如 0)的 SCSI 硬碟 |
sdb |
下一個 SCSI ID (例如 1)的 SCSI 硬碟 |
sdc |
下一個 SCSI ID (例如 2)的 SCSI 硬碟 |
sda1 |
在第一塊 SCSI 硬碟上的第一個分割區 |
sdd10 |
在第四塊 SCSI 硬碟上的第十個分割區 |
sr0 |
SCSI ID 最小的 SCSI 光碟機 |
sr1 |
下一個 SCSI ID 的 SCSI 光碟機 |
ttyS0 |
序列埠 0,即 MS-DOS 下的 COM1 |
ttyS1 |
序列埠 1,即 MS-DOS 下的 COM2 |
psaux |
PS/2 滑鼠設備 |
gpmdata |
虛擬設備,中繼從GPM(滑鼠)服務傳來的資料 |
cdrom |
指向光碟機的符號鏈結 |
mouse |
指向滑鼠設備檔的符號鏈結 |
null |
Anything written to this device will disappear |
zero |
可以從該設備永無休止地讀出零 |
The mouse can be used in both the Linux console (with gpm) and the X window environment. Normally, this is a simple matter of installing gpm and the X server itself. Both should be configured to use /dev/input/mice as the mouse device. The correct mouse protocol is named exps2 in gpm, and ExplorerPS/2 in X. The respective configuration files are /etc/gpm.conf and /etc/X11/xorg.conf.
Certain kernel modules must be loaded in order for your mouse to work. In most cases the correct modules are autodetected, but not always for old-style serial and bus mice[30], which are quite rare except on very old computers. Summary of Linux kernel modules needed for different mouse types:
| Module | Description |
|---|---|
| psmouse | PS/2 mice (should be autodetected) |
| usbhid | USB mice (should be autodetected) |
| sermouse | Most serial mice |
| logibm | Bus mouse connected to Logitech adapter card |
| inport | Bus mouse connected to ATI or Microsoft InPort card |
To load a mouse driver module, you can use the modconf command (from the package with the same name) and look in the category kernel/drivers/input/mouse.
[30] Serial mice usually have a 9-hole D-shaped connector; bus mice have an 8-pin round connector, not to be confused with the 6-pin round connector of a PS/2 mouse or the 4-pin round connector of an ADB mouse.