I'm looking to create a function in C++ running on Linux that returns true if the CDRom media is a DVD and false if its anything else (e.g. Audio CD).
I have been using ioctl
with linux/cdrom.h
.
I tried using the DVD_READ_STRUCT
but it always returns true. Maybe I'm using it incorrectly.
dvd_struct s
if (ioctl(hDEV, DVD_READ_STRUCT, &s)) {
return true;
}
The official documentation is a bit more helpful. You have to specify the request type and any required inputs before calling
ioctl
.The really interesting stuff requires issuing SCSI commands like dvd+rw-tools, cdrkit, and cdrdao. Doing this is a bit painful, though, and it's not necessary if you don't need to know if the disc is recordable, rewritable, or pressed.