Friday, 17 July 2009

CD/DVD Drive capabilities

I found the following little nugget while trying to discover the capabilities of my laptop DVD drive:

$ sudo /lib/udev/cdrom_id --export /dev/sr0
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_DVD=1
ID_CDROM_DVD_R=1
ID_CDROM_DVD_RAM=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1

OK, so it's a little dirty calling /lib/udev/cdrom_id, but it's a quick way of doing the CDROM_GET_CAPABILITY ioctl() on a optical media device.

2 comments:

  1. is there any advantage using this over lshw?

    i note that using this method, the output indicated that my dvd drive supported more features than lshw

    ReplyDelete
  2. @Anonymous: If /lib/udev/cdrom_id provides more accurate information than lshw then it is a better tool in that respect. Each tool has there own advantages and disadvantages...

    ReplyDelete