How can I disable the button of my CD/DVD drive?

Thanks to @Affix's answer which gave me the right direction to head, I've figured out the solution to the problem.

The problem is definitely caused by UDEV as you've guessed. The issue is this line that is in most UDEV files related to the cdrom drive.

Example

On Fedora 19 there is the following file, /usr/lib/udev/rules.d/60-cdrom_id.rules. In this file is the following line which is co-opting the eject button for CD/DVD devices.

ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"

You can work around the issue and disable UDEV's ability to co-opt the eject button by doing the following:

  1. Make a copy of the file 60-cdrom_id.rules

    $ sudo cp /usr/lib/udev/rules.d/60-cdrom_id.rules /etc/udev/rules.d/.
    
  2. Edit this copied version of the file and comment out the line containing the string, DISK_EJECT_REQUEST.

    $ sudoedit /etc/udev/rules.d/60-cdrom_id.rules
    
  3. Save the file and the change should be noticeable immediately!

The above solution fixes the problem for both eject and cdctl. So now the following commands work as expected:

lock the drive

$ eject -i on /dev/sr0
eject: CD-Drive may NOT be ejected with device button

-or-

$ cdctl -o1

unlock the drive

$ eject -i off /dev/sr0
eject: CD-Drive may be ejected with device button

-or-

$ cdctl -o0

Add the line:

DISC_EJECT_REQUEST

to the CD ROM udev rules. This will enable you to lock with:

eject -i