# /etc/udev/rules.d/25-lfs.rules: Rule definitions for LFS.

# Core kernel devices

KERNEL=="ptmx",     MODE="0666",    GROUP="tty"
KERNEL=="random",   MODE="0444"
KERNEL=="urandom",  MODE="0444"
KERNEL=="kmem",     MODE="0640",    GROUP="kmem"
KERNEL=="mem",      MODE="0640",    GROUP="kmem"
KERNEL=="port",     MODE="0640",    GROUP="kmem"
KERNEL=="null",     MODE="0666"
KERNEL=="zero",     MODE="0666"
KERNEL=="full",     MODE="0666"
KERNEL=="aio",      MODE="0444"
KERNEL=="kmsg",     MODE="0600"
KERNEL=="rtc",      MODE="0666"

# Comms devices

KERNEL=="ttyS[0-9]*",                   GROUP="dialout"
KERNEL=="ttyUSB[0-9]*",                 GROUP="dialout"
KERNEL=="rfcomm[0-9]*",                 GROUP="dialout"
KERNEL=="tty[BCDEFHILMPRSTUVWX][0-9]*", GROUP="dialout"
KERNEL=="ttyS[ACIR][0-9]*",             GROUP="dialout"
KERNEL=="ttyUSB[0-9]*",                 GROUP="dialout"
KERNEL=="ttyACM[0-9]*",                 GROUP="dialout"
KERNEL=="ippp[0-9]*",                   GROUP="dialout"
KERNEL=="isdn[0-9]*",                   GROUP="dialout"
KERNEL=="isdnctrl[0-9]*",               GROUP="dialout"
KERNEL=="capi",                         NAME="capi20",  SYMLINK="isdn/capi20"
KERNEL=="capi?*",                       NAME="capi/%n", GROUP="dialout"
KERNEL=="dcbri[0-9]*",                  GROUP="dialout"
KERNEL=="ircomm[0-9]*",                 GROUP="dialout"

# TTY's

KERNEL=="tty",          MODE="0666",    GROUP="tty"
KERNEL=="tty[0-9]*",    MODE="0666",    GROUP="tty"
KERNEL=="vcs*",         MODE="0600"
KERNEL=="console",      MODE="0622",    GROUP="tty"

# ALSA devices go in their own subdirectory

KERNEL=="controlC[0-9]*",   GROUP="audio",  NAME="snd/%k"
KERNEL=="hw[CD0-9]*",       GROUP="audio",  NAME="snd/%k"
KERNEL=="pcm[CD0-9cp]*",    GROUP="audio",  NAME="snd/%k"
KERNEL=="midiC[D0-9]*",     GROUP="audio",  NAME="snd/%k"
KERNEL=="timer",            GROUP="audio",  NAME="snd/%k"
KERNEL=="seq",              GROUP="audio",  NAME="snd/%k"

# Sound devices

KERNEL=="admmidi*",     GROUP="audio"
KERNEL=="adsp*",        GROUP="audio"
KERNEL=="aload*",       GROUP="audio"
KERNEL=="amidi*",       GROUP="audio"
KERNEL=="amixer*",      GROUP="audio"
KERNEL=="audio*",       GROUP="audio"
KERNEL=="dmfm*",        GROUP="audio"
KERNEL=="dmmidi*",      GROUP="audio"
KERNEL=="dsp*",         GROUP="audio"
KERNEL=="midi*",        GROUP="audio"
KERNEL=="mixer*",       GROUP="audio"
KERNEL=="music",        GROUP="audio"
KERNEL=="sequencer*",   GROUP="audio"

# Printing devices

KERNEL=="lp[0-9]*",         GROUP="lp"
KERNEL=="parport[0-9]*",    GROUP="lp"
KERNEL=="irlpt[0-9]*",      GROUP="lp"

# Input devices go in their own subdirectory

KERNEL=="mice",     MODE="0644",    NAME="input/%k"	SYMLINK="mouse"
KERNEL=="mouse*",   MODE="0644",    NAME="input/%k"
KERNEL=="event*",   MODE="0644",    NAME="input/%k"
KERNEL=="js*",      MODE="0644",    NAME="input/%k"
KERNEL=="ts*",      MODE="0644",    NAME="input/%k"

KERNEL=="psaux",    MODE="0644"
KERNEL=="js",       MODE="0644"
KERNEL=="djs",      MODE="0644"

# USB devices go in their own subdirectory

SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c"
KERNEL=="hiddev*",          NAME="usb/%k"
KERNEL=="auer*",            NAME="usb/%k"
KERNEL=="legousbtower*",    NAME="usb/%k"
KERNEL=="dabusb*",          NAME="usb/%k"
BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp", NAME="usb/%k"

# DRI devices are managed by the X server, so prevent udev from creating them

KERNEL=="card*",    NAME=""

# Video devices

KERNEL=="fb[0-9]*",     MODE="0620",    GROUP="video"
KERNEL=="agpgart",      GROUP="video"
KERNEL=="video[0-9]*",  GROUP="video"
KERNEL=="radio[0-9]*",  GROUP="video"
KERNEL=="vbi[0-9]*",    GROUP="video"
KERNEL=="vtx[0-9]*",    GROUP="video"

# Storage/memory devices

KERNEL=="fd[0-9]*",             GROUP="floppy"
KERNEL=="ram[0-9]*",            GROUP="disk"
KERNEL=="raw[0-9]*",            GROUP="disk",   NAME="raw/%k"
KERNEL=="hd*",                  GROUP="disk"
KERNEL=="sd[a-z]",              GROUP="disk"
KERNEL=="sd[a-z][0-9]*",        GROUP="disk"
KERNEL=="sd[a-i][a-z]",         GROUP="disk"
KERNEL=="sd[a-i][a-z][0-9]*",   GROUP="disk"
KERNEL=="dasd[0-9]*",           GROUP="disk"
KERNEL=="loop[0-9]*",           GROUP="disk"
KERNEL=="md[0-9]*",             GROUP="disk"

# dmsetup and lvm2 related programs create devicemapper devices so we prevent
# udev from creating them

KERNEL=="dm-*",             OPTIONS+="ignore_device"
KERNEL=="device-mapper",    OPTIONS+="ignore_device"

KERNEL=="ht[0-9]*",     GROUP="tape"
KERNEL=="nht[0-9]*",    GROUP="tape"
KERNEL=="pt[0-9]*",     GROUP="tape"
KERNEL=="npt[0-9]*",    GROUP="tape"
KERNEL=="st[0-9]*",     GROUP="tape"
KERNEL=="nst[0-9]*",    GROUP="tape"

# Network devices

KERNEL=="tun",  NAME="net/%k"
