Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Cdrom eject button
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jeff777
n00b
n00b


Joined: 04 Nov 2003
Posts: 45
Location: Vancouver, BC

PostPosted: Wed May 24, 2006 6:21 am    Post subject: [Solved] Cdrom eject button Reply with quote

Is it possible to configure Gnome to unmount and eject a cdrom when the eject button on the cdrom is pushed?

Currently, the eject button works only if the drive is empty. To eject a mounted disk I have to right click on the cdrom in nautilus and choose eject, or type eject /cdrom at the prompt.

I'm using hal, dbus, ivman.


Last edited by jeff777 on Fri May 26, 2006 5:04 am; edited 1 time in total
Back to top
View user's profile Send private message
simeli
Apprentice
Apprentice


Joined: 15 Jun 2005
Posts: 193
Location: Switzerland, Zurich

PostPosted: Wed May 24, 2006 7:10 am    Post subject: Reply with quote

what you could try is as root
Code:
sysctl dev.cdrom.lock=0


or to make the behavior persist

Code:
sh -c ‘echo “dev.cdrom.lock=0? >> /etc/sysctl.conf’


this at least works on an ubuntu box. don't have my gentoo machine here to try right now.
the reason apple dropped the eject cd tray button on all their machines is probably (i’m not sure) the same ubuntu has to not let you eject mounted filesystems, it’s a sort of golden rule of all unix systems…

now, if you still want to eject the cd with that button, there are several options:
1) you could use automount, or some variant of it like supermount. several distributions use or used automount (maybe knoppix?) or the external patch supermount (probably mandriva, at least when it was called mandrake). or submount. or something else. it is probably not encouraged anymore.
2) youi could disable locking on the cdrom just like you learned here, at the risk of some applications crashing, or not being able to use the cd till a reboot if you do something in the wrong order (for example you eject the cd before closing a bogus app that was using it and then you try to mount another one, don’t really know…)
3) you could use code that check the cd tray button every second or so and reports if it has been pressed. if it is, a clean eject is issued by the os, if it is not, nothing happens. where to find such code? here: http://blog.bureado.com.ve/?p=281
it’s a small program, you need to compile it. it works somewhat…. now the interesting thing is that recent versions of gnome-volume-manager should use a method similar to this one, but i don’t see it working. i hope this will get corrected. another thing to consider is that not every cd player can be polled this way, so this method only works for some of them.
_________________
Pentium M 740 on MSI 915GM SPEEDSTER-FA4, 2x512MB Corsair XMS2 DDR2 667 Memory, Zalman CNPS7000B AlCu, Samsung SpinPoint P120 250GB SATAII, Hauppauge WinTV PVR-500, Enermaxx Liberty 400, Antec P180

Husaberg FS650e Force Edition [http://www.husaberg.se]
Back to top
View user's profile Send private message
jeff777
n00b
n00b


Joined: 04 Nov 2003
Posts: 45
Location: Vancouver, BC

PostPosted: Fri May 26, 2006 5:04 am    Post subject: Reply with quote

Thanks for your reply. Disabling the cdrom lock with sysctl worked perfectly! I was worried that the system would not be smart enough to notice that I'd ejected the cd and leave it mounted. Fortunately, hal worked better than I'd expected.

When I ejected the cd, the system was smart enough to unmount it automatically. Not only that, but when I ejected the cd while browsing it in nautilus, nautilus automatically changed the directory.

I even tried pressing the eject button while playing a movie from the cd with mplayer. I expected the system to crash or lock up, but instead Mplayer closed properly by itself and the disk was cleanly unmounted. This is exactly what I wanted. Thanks for your help.
Back to top
View user's profile Send private message
Apollyon
n00b
n00b


Joined: 10 Mar 2003
Posts: 22
Location: Spain

PostPosted: Wed Dec 20, 2006 8:35 am    Post subject: Reply with quote

I also want to be able to umount a CD-ROM by pressing the eject button, but I'm a little weary of the "don't lock the tray" solution. Is this really the recommended way to do this? I know that most of the times I'll be reading from the CD, so no syncing is necessary, but it still feels kind of wrong...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum