How to lock an optical drive tray closed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.  I'm trying to figure out how to lock the tray of an optical
drive, so that the drive will not open the tray when the user presses
the hardware "eject" button on the drive.

This seems straightforward, because there is a well-documented list of
IOCTLs for optical drive control, and one of them is CDROM_LOCKDOOR.
(See Edward A. Falk's "cdrom.txt" doc file, and
also /usr/include/linux/cdrom.h.)

However, in my tests, the drive still ejects the disk even when I use
the CDROM_LOCKDOOR IOCTL to lock it.

I am checking the return codes and getting a successful response from
the ioctl() function call.

I have tried my door-locking ioctl call on two different computers with
two completely different optical drives, and it did not work on either.
Checking /proc/sys/dev/cdrom/info, I find that both computers are "Can
lock tray: 1"

Both computers are running Ubuntu 7.10 "Gutsy Gibbon", so they have very
up-to-date kernels.

I have searched on Google for hours, and the web pages pretty much say
that I should be using CDROM_LOCKDOOR to lock the door.

My application is using the optical drive.  My plan is to lock the drive
door, but watch the D-Bus "system" bus for EjectPressed events, and do a
nice and tidy shutdown and eject in response to that event.  Currently
the drive just ejects, and my application has errors as a result.

Should I be looking for a bug in my code, or is there some other IOCTL I
should be using, or what?

Thank you for any advice you can give me.
-- 
Steve R. Hastings    "Vita est"
steve@xxxxxxxxxxxx    http://www.blarg.net/~steveha


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux