vote up 1 vote down star

My todler is continuosly pushing the cd/dvd button and trying to destroy the tray. I know it should be possible to let her life harder, disabling the eject button. How to do that? This is ubuntu (shouldn't matter) linux. See also the this related question.

And the same one as this one, but on windows

EDIT: this is Hardy

flag

80% accept rate
This reminds me of a video of someone who had a script that continuously ejected and closed the disc drive. There was a string connecting the disk tray to a baby's rocker. And the cd drive just rocked the baby! – Jonno_FTW Nov 18 at 16:14

4 Answers

vote up 1 vote down check

You might want to try this out...

http://www.poweradded.net/2009/09/cddvd-tray-lockunlock-under-linux.html

link|flag
This is good, it works pretty well (the code is not robust, but I can improve it myself, if I'll never need) – Davide Dec 4 at 4:54
vote up 3 vote down

At the command line

eject -i 1

To return to normal,

eject -i 0

Or you can software eject it using

eject

In all cases, you can add a device name if you have more than one ejectable device.

Apparently not all versions of eject seem to work

If you want to do it the hard way, then

sudo echo 1 > /proc/sys/dev/cdrom/lock
will work with any version of eject, because you're not using eject

link|flag
Thanks, but it doesn't work for my OS: $ eject -i 1 eject: invalid option -- i $ eject --version eject version 2.1.5 by Jeff Tranter (tranter@pobox.com) – Davide Nov 18 at 3:08
Grrr, comments don't align code snippet correctly, and cannot be edited! Let me try again: $ eject -i 1 results in eject: invalid option -- i - and you should be able to figure out the version from the other comment – Davide Nov 18 at 3:10
Weird. $ eject -i 1 works fine for me in Karmic. Version 2.1.5. – regan Nov 18 at 3:27
1  
If you want to do it the hard way, then <code><pre>sudo echo 1 &gt; /proc/sys/dev/cdrom/lock</pre></code> will work with any version of eject, because you're not using eject. – gorilla Nov 18 at 14:08
@gorilla, you should add that as your own answer.. – ~quack Nov 18 at 15:28
vote up 1 vote down

Ubuntu's default automounter doesn't lock the CD/DVD try when it mounts an inserted disc. But if you mount the disc manually (say, with sudo), the tray should lock and stay locked until you dismount the disc.

So this process would accomplish what you want, without disabling other functionality, and you could even script it for quick access:

  1. Insert a disc,
  2. Run sudo umount /media/cdrom, then
  3. Run sudo mount /dev/cdrom /media/cdrom

Obviously, replace those paths and devices with ones your system uses.

link|flag
Works, but it's inconvenient (actually I did know about that). Thanks for the answer, anyway. – Davide Dec 4 at 4:53
vote up 0 vote down

A user left a comment on another question. The comment should have been a separate answer. I'm writing his suggestion here, since it might work for somebody (it doesn't in Hardy Haron) and might be more convenient than installing the code from my accepted question.

To lock:

sudo echo 1 > /proc/sys/dev/cdrom/lock

To unlock:

sudo echo 0 > /proc/sys/dev/cdrom/lock

Of course small shell scripts, possibly linked from the panel would be used.

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.