udev – Linux dynamic device management

ABOUT UDEV

udev - Linux dynamic device management
udev (userspace /dev) is a device manager for the Linux kernel

CONFIG FILE RELATED

# do not edit this file, it will be overwritten on update

ACTION=="remove", GOTO="cdrom_end"
SUBSYSTEM!="block", GOTO="cdrom_end"
KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="cdrom_end"

# unconditionally tag device as CDROM
KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1"

# media eject button pressed
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="cdrom_end"

# import device and media properties and lock tray to
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $tempnode"

LABEL="cdrom_end"
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/lib/udev/rules.d/60-cdrom_id.rules" [readonly] 18L, 584C                                  1,3           All

RELATED SHELL SESSION (cdrom)

[bash]
$cat /proc/sys/dev/cdrom/info
CD-ROM information, Id: cdrom.c 3.20 2003/12/17

drive name: sr0
drive speed: 48
drive # of slots: 1
Can close tray: 1
Can open tray: 1
Can lock tray: 1
Can change speed: 1
Can select disk: 0
Can read multisession: 1
Can read MCN: 1
Reports media changed: 1
Can play audio: 1
Can write CD-R: 1
Can write CD-RW: 1
Can read DVD: 1
Can write DVD-R: 1
Can write DVD-RAM: 1
Can read MRW: 1
Can write MRW: 1
Can write RAM: 1

$

[/bash]

FROM MANUAL

udev  supplies  the system  software  with  device events,  manages permissions of  device nodes and
may create  additional symlinks in the  /dev  directory, or  renames  network  interfaces. The  kernel
usually just assigns unpredictable  device names based on the order of discovery. Meaningful symlinks
or network device names provide away to reliably  identify  devices based  on  their properties  or
current configuration. The udev  daemon, udevd(8),  receives device uevents  directly from the kernel 
whenever  a device is added or  removed from the system, or  it changes its  state. When  udev receives
a device  event, it matches  its  configured  set   of  rules  against  various  device attributes  to
identify the  device. Rules  that match  may provide additional device information to be  stored in the
udev database or to be used to create meaningful symlink names. All  device  in formation  udev  processes
is stored  in  the  udev database and sent out to  possible event subscribers. Access to all stored  data
and  the  event  sources is  provided  by the  library libudev.  

source: Manual

LINKS
https://www.linux.com/news/udev-introduction-device-management-modern-linux-system
https://en.wikipedia.org/wiki/Udev
https://www.thegeekdiary.com/beginners-guide-to-udev-in-linux/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s