On Wed, Jan 29, 2014 at 4:48 PM, Brendan Donegan <
brendan.donegan@xxxxxxxxxxxxx> wrote:
Hi,
My proposal to refactor the optical resource script goes something like
this:
DVD drive
udevadm info --export-db
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
BluRay Drive
udevadm info --export-db
E: ID_CDROM=1
E: ID_CDROM_BD=1
E: ID_CDROM_BD_R=1
E: ID_CDROM_BD_RE=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_MEDIA_BD_RE=1
Heh, funny that _CDROM_BD was too easy apparently so they added _MEDIA,
anyway.
So we use udevadm to figure out which capabilities a drive has. This seems
almost too straightforward to be true (why did we use wodim if it's this
simple?) so I'm guessing there's something I'm missing. If not all the
better.
Nope, this looks quite right. I'd like to convert this to a nice resource.
(Look it even tells you if there's a disk inserted and what kind of media
it is! ID_CDROM_MEDIA_BD_RE)
Dragons be here: we don't re-run resources. I'd like to have special "live"
resources that are kind-of re-executed before each attempt to use them but
we don't have those now. If the user had a disk while the resource ran then
removed it afterwards but before something that depends on it gets a chance
to run the test will fail.
Thanks
ZK
PS: cross-posting to the new mailing list