Overhaul of optical drive detection
A little while ago, we were testing Xfburn CD/DVD burner app, and it was failing to detect the optical drive. Today, forum member vtpup testing Easy 7.3.7 reported pBurn not detecting the optical drive because /dev/cdrom did not exist.
Have figured out what is wrong. The udev rule /usr/lib/udev/rules.d/60-cdrom_id.rules was removed in the woofQ2 build system. Instead, /etc/rc.d/rc.sysinit does some optical drive detection and creates symlinks /dev/cdrom and /dev/dvd to /dev/sr0
That is ancient code in rc.sysinit, back from the very early Puppy days. Useless now, as it only works for internal optical drives. I recently purchased a usb optical DVD drive for testing, which made me realise how useless that rc.sysinit code is.
The optical detection code has now been removed from rc.sysinit, there is now /etc/udev/rules.d/60-cdrom_id.rules:
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 $devnode", GOTO="cdrom_end"
# import device and media properties and lock tray to
# enable the receiving of media eject button events
# BK do not lock tray...
#IMPORT{program}="cdrom_id --lock-media $devnode"
IMPORT{program}="cdrom_id $devnode"
KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
# BK cdrom_id should have set ID_CDROM_DVD
KERNEL=="sr0", ENV{ID_CDROM_DVD}== "1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
LABEL="cdrom_end"
Now, when I plugin my usb DVD drive, /dev/cdrom and /dev/dvd appear, unplug and they disappear. Great!
Most important, the rule runs 'cdrom_id', which sets lots of parameters, that we can read:
# udevadm info /dev/sr0
P: /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.2/3-1.2:1.0/host1/target1:0:0/1:0:0:0/block/sr0
N: sr0
L: -100
S: cdrom
S: dvd
E: DEVLINKS=/dev/cdrom /dev/dvd
E: DEVNAME=/dev/sr0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.2/3-1.2:1.0/host1/target1:0:0/1:0:0:0/block/sr0
E: DEVTYPE=disk
E: DISKSEQ=52
E: ID_CDROM=1
E: ID_CDROM_CD=1
E: ID_CDROM_CD_R=1
E: ID_CDROM_CD_RW=1
E: ID_CDROM_DVD=1
E: ID_CDROM_DVD_PLUS_R=1
E: ID_CDROM_DVD_PLUS_RW=1
E: ID_CDROM_DVD_PLUS_R_DL=1
E: ID_CDROM_DVD_R=1
E: ID_CDROM_DVD_RAM=1
E: ID_CDROM_DVD_RW=1
E: ID_CDROM_MEDIA=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: MAJOR=11
E: MINOR=0
E: SUBSYSTEM=block
E: USEC_INITIALIZED=5199413668
This is good, I am now fully expecting that Xfburn will work,
though not yet tested.
Tags: easy