Detecting write-protection on DVD-RAM media
My platform includes a DVD drive on RedHat. We have specified the hdc=ide-scsi option in lilo.conf so that a DVD-Ram device can be read and written. This all works fine, however if a user flips the write-protect tab, the driver still writes to the /dvd node where the device is mounted. From the users viewpoint, there are no signs of a problem until the device is un-mounted and re-mounted. At that point, of course, the data written is gone. I need a way to determine from the application level that the device is write-protected. Can you tell me how I might be able to read the status of the write-protect. I am certain there must be a way since the /var/log/messages file contains the following info:
Nov 22 19:37:42 radisys81 kernel: Current sd0b:00: sense key Data Protect
Nov 22 19:37:43 radisys81 kernel: Additional sense indicates Write protected
This seems to indicate that the driver is reporting the condition to the OS.