Implementation of plug-and-play functions in Linux

Source: Internet
Author: User
Article Title: How to Implement the plug-and-play function in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

It mainly consists of hotplug, udev, D-BUS, HAL, gamin components.

Hotplug is part of the kernel and automatically configures the kernel status when the device is inserted or pulled out.

Udev is a part of hotplug and is responsible for maintaining the dynamic/dev directory so that the content of the/dev directory is consistent with the current system status.

A D-BUS can send messages between applications, for example, messages connected to a printer can be sent to HAL.

HAL can integrate information from multiple sources, including kernel messages, configuration files, and so on, and then operate based on the message of the D-BUS.

Gamin is an improved File status monitoring program. For example, insert a USB flash drive. Hotplug automatically loads the required modules, creates corresponding/dev/sda1 nodes in udev, and sends messages to HAL. After receiving the messages, HAL sends the messages according to the configuration file, it runs fstab-sync to modify fstab and creates/media sub-directories as Mount Points. After gamin detects a change in fstab, it notifies the desktop system. The desktop system creates a drive icon in the computer project. When the USB flash drive is detached, the module is detached, the device file is deleted, the corresponding entries in fstab are deleted, and the Mount Points in the/media Directory are also deleted.

This process is very useful and can be used by different devices. For example, after a music CD is put into the optical drive, HAL can start the playing program or rail capturing program. Another important purpose, as mentioned in the third phase of redhat magazine, is NetworkManager. users who use mobile wireless communication may frequently change their network connection methods. Only by using hotplug and hal to collaborate can they quickly respond and dynamically switch network configurations.

Related Article

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.