# This is 54-fatdog-permission.rules
# this file provide rules to manage device node permissions according for Fatdog64 security model
#
# Note: this is originally 50-udev-default.rules

KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
KERNEL=="ptmx",				GROUP="tty", MODE="0660"
KERNEL=="tty",				GROUP="tty", MODE="0660"
KERNEL=="tty[0-9]*",		GROUP="tty", MODE="0620"
KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"

# serial - james GROUP="dialout" replaced with GROUP="users"
KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="users", MODE="0660" 
KERNEL=="mwave",		GROUP="users", MODE="0660" 
KERNEL=="hvc*|hvsi*",	GROUP="users", MODE="0660" 

# virtio serial / console ports
KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"

# mem - james removed GROUP="kmem" and MODE="0640", changed to MODE="0600"
KERNEL=="null|zero|full|random|urandom", MODE="0666"
KERNEL=="mem|kmem|port|nvram",	MODE="0600"

# input
SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id"
KERNEL=="mouse*|mice|event*",	MODE="0640"
KERNEL=="ts[0-9]*|uinput",	MODE="0640"
KERNEL=="js[0-9]*",		MODE="0644"

# video4linux
SUBSYSTEM=="video4linux",	GROUP="video"
KERNEL=="vttuner*",		GROUP="video"
KERNEL=="vtx*|vbi*",		GROUP="video"
KERNEL=="winradio*",		GROUP="video"

# graphics
KERNEL=="agpgart",		GROUP="video"
KERNEL=="pmu",			GROUP="video"
KERNEL=="nvidia*|nvidiactl*",	GROUP="video"
SUBSYSTEM=="graphics",		GROUP="video"
SUBSYSTEM=="drm",		GROUP="video"
KERNEL=="fb*",	MODE="0660", GROUP="wheel"

# sound
SUBSYSTEM=="sound",		GROUP="audio"

# DVB (video)
SUBSYSTEM=="dvb", GROUP="video"

# FireWire (firewire-core driver: IIDC devices, AV/C devices)
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video"
SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video"
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video"
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video"

# libusb device nodes
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id"

# printer
KERNEL=="parport[0-9]*",	GROUP="lp"
SUBSYSTEM=="printer",		KERNEL=="lp*", GROUP="lp"
SUBSYSTEM=="ppdev",		GROUP="lp"
SUBSYSTEM=="usbmisc",	KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp"
KERNEL=="lp[0-9]*",		GROUP="lp"
KERNEL=="irlpt[0-9]*",		GROUP="lp"
# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to
# the ones from the old usblp kernel module
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp", MODE="0664"

# block
SUBSYSTEM=="block", GROUP="disk"

# floppy - james changed GROUP="floppy" to GROUP="users"
SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="users", MODE="0660" 

# cdrom - james changed GROUP="cdrom" to GROUP="users" 
SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="users", MODE="0660"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="users", MODE="0660"
KERNEL=="pktcdvd[0-9]*", GROUP="users", MODE="0660"
KERNEL=="pktcdvd", GROUP="users", MODE="0660"

# tape - james commented out
#KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape"
#KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape"
#SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape"

# block-related
KERNEL=="sch[0-9]*", GROUP="disk"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk"
KERNEL=="pg[0-9]*", GROUP="disk"
KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk"
KERNEL=="rawctl", GROUP="disk"
SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk"
SUBSYSTEM=="aoe", GROUP="disk", MODE="0220"
SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"

# network
KERNEL=="tun",			MODE="0666", OPTIONS+="static_node=net/tun"
KERNEL=="rfkill",		MODE="0644"

# CPU
KERNEL=="cpu[0-9]*",		MODE="0444"

KERNEL=="fuse",			MODE="0666", OPTIONS+="static_node=fuse", \
  RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections"

SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"
KERNEL=="mmtimer",		MODE="0644"
KERNEL=="rflash[0-9]*",		MODE="0400"
KERNEL=="rrom[0-9]*",		MODE="0400"

# KVM and loop devices for UML
KERNEL=="kvm", GROUP="kvm", MODE="0660"
KERNEL=="loop1", MODE="0664"

# Only for eudev 1.7. "firmware" built-in is removed in newer udev
#SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware"

# ARM framebuffer and GPUs
KERNEL=="galcore",   GROUP="video", MODE="0660"
KERNEL=="mali",      GROUP="video", MODE="0660"
KERNEL=="ump",       GROUP="video", MODE="0660" 
KERNEL=="disp",      GROUP="video", MODE="0660"
KERNEL=="cedar_dev", GROUP="video", MODE="0660" 
