Since everything in Linux is represented as file, the devices are no exception. Every device file in Linux resides in the /dev directory. These device files are needed to direct input and output through them. The device files actually contain no data, they serve only as a linking bridge between the user and the device itself. They only inform about the location of the device and communicate with it.
Here is a list of common device names in Linux systems:
And the usual disk device names:
There are four types of devices:
Unbuffered/character devices are the devices which transfer data as a stream of bytes. Such devices would be a terminal or a printer. Block devices transfer data in blocks of fixed length. They are opposite of the character devices. The disk drives are example of block devices. FIFO stands for First In First Out. When using a FIFO device, the data which first got in, will be the first which will get out. FIFO devices allow simultaneous memory data write and read operations.
In order for some device to work, it has to be supported by the kernel. So, when building your kernel, make sure that the appropriate support is enabled. For instance, if you use USB devices, enable USB support and so on. If the kernel support is enabled, and the device is plugged in, then the device modules should be loaded automatically. If not, then you can load the appropriate modules using the insmod command. Insmod actually installs a loadable module into the kernel. For instance:
should load the specified module name into the kernel. Software like hotplug and coldplug help in recognizing devices and loading the modules into the kernel automatically.
In order to explain the device drivers, the term controller should be well understood. Controller is the hardware which controls and observe the communication between the system and the device itself. It does usually low-level operations, like error checking, data transfer, location of data etc. For the controller to operate successfully, the device drivers must be installed. A driver is nothing more then a software which controls the controller. The driver software must match the type and the version of the device you would like to use. Device driver performs: probe, attach, open, close, read, write, reset, stop, timeout, select, strategy, dump, psize, ioctl, process transmit and receive interrupts to the device in use.
A device could be made with the mknod command. It takes several parameters:
$mknod device device_type major_number minor_number
A real-life example:
$mknod /devices/psaux c 10 1.
The first parameter is the device name ( in the example, psaux). The second parameter is the type of device, already discussed ( c - character type). The last two parameters are the major and the minor number. The major number identifies the kernel driver which communicates with the device, while the minor number specifies the location of the device, it identifies which particular instance of the given device type is to be addressed. The major number directs the user to the proper controller and mode. The minor number is divided in ranges. If its value is from 0 up to 7, then it directs to portions of drive 0, from 8 to 15 it directs to portions of drive 1 and so on.