Linux Device Node

Source: Internet
Author: User

A few days ago, when learning Android often encounter XXXX node, so now refer to: http://blog.csdn.net/Bestrem_9/archive/2009/03/19/4004335.aspx (there are other documents) will summarize the concept of node is as follows:

The concept of a node is required for device management.

There are two types of devices in Linux: character devices (unbuffered and sequential access only) and block devices (with buffering and random access ). Each character device and block device must have the primary and secondary device numbers. devices with the same primary device number are similar devices (using the same driver ). Among these devices, some devices are abstract to the physical hardware that actually exists, while some devices are functions provided by the kernel itself (not dependent on specific physical hardware, it is also called "Virtual Device "). Each device has a corresponding file (node) under the/dev directory ). You can run the CAT/proc/devices command to view the master device Number of the currently loaded device driver.

Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In a system, a hardware description is usually used as a term for a device, including disks, printers, video cards, and keyboards. When FreeBSD is started, most devices can be detected and displayed. For more information, see/Var/run/dmesg. boot, All information is in the Guide.

For example,Acd0Is the first ide cd device, andKbd0It indicates the keyboard.

In UNIX operating systems, most devices have special access files called device nodes./DevDirectory.

After adding a new device to the system or compiling the support of additional devices into the kernel, you must create a device node for it.

Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When we first wrote a Linux Device Driver, we often used the mknod command to manually create a device node. In fact, the Linux Kernel provides us with a set of functions, it can be used to automatically create a device node in the/dev directory when the module is loaded, and delete the node when the module is detached. Of course, the prerequisite is that the user space is transplanted with udev.

Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Finally, you must understand the concept of nodes in device management and driver writing.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.