1

My keyboard switch for ejecting the CDROM does not work though it displays an eject button on the screen. I need to make it work. I know ejecting a cdrom using system call is as simple as

ioctl(cdromfd,CDROMEJECT,0)

But I don't know how to connect the an executable that contains the above system call and the event of pressing the eject key? Or shall I rely on kernel level? If then how?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
PaulDaviesC
  • 537
  • 1
  • 4
  • 12
  • 1
    It might try to call [`eject`](http://eject.sourceforge.net/manpage.html) -- have you installed that? (Does `eject /dev/cdrom` in a terminal work?) – sr_ Jan 15 '13 at 08:35
  • I don't have any problem with ejecting the cdrom using eject command. However eject key on my keyboard does not work. – PaulDaviesC Jan 15 '13 at 10:31
  • I was just trying to find out what could be the reason for your eject key causing *the eject button display on screen* while failing to actually eject the cdrom... What's your desktop environment? **The cdrom isn't mounted, right?** – sr_ Jan 15 '13 at 11:18
  • I am using the default desktop environment of Ubuntu12.04. – PaulDaviesC Jan 15 '13 at 11:34
  • 1
    So GNOME? I'm not a user but a lot of DEs and window managers allow you to create custom shortcuts. If there is a GUI interface to set them in, it will probably pick up the correct keycode for you, then you just link that to the `eject` command. – goldilocks Jan 15 '13 at 11:47
  • 1
    Yeah! It did work. I was wondering how the things where working internally :) – PaulDaviesC Jan 15 '13 at 11:57

0 Answers0