Unmounting and 'eject' press
Ikke
eikke at eikke.com
Tue Jun 1 13:17:01 PDT 2004
> Hi,
>
> It turns out this was actually quite easy to do, there was a good
> example of how to do it here
>
> http://www.ussg.iu.edu/hypermail/linux/kernel/0202.0/att-0603/01-cd_poll.c
>
> Only caveat is that is requires MMC-2 drives or higher (all drives
> shipped within the past 3-4 years are MMC-2 compliant), but anyway it is
> now integrated with HAL.
>
> If eject is pressed, while a disc is mounted HAL will emit an
> 'EjectPressed' condition on the HalDevice representing the optical disc.
> In hal-device-manager it looks like this
>
> Condition EjectPressed,
> device=/org/freedesktop/Hal/devices/block_22_0-disc
> message = ['EjectPressed', '/udev/hdc']
>
> Since HAL cowardly refuses to touch policy it's up to higher level
> components to actually do something about it :-)
Jayjay, a big update on this. I did some testing here with my dynosaur,
didnt work as expected. I asked some guys on #love-sources at freenode to do
some testing for me too, results follow, and also ow3n (#freedesktop, and on
this mailing list) helped me further.
First of all, I wrote a little testing program
(http://www.eikke.com/tmp/ejecttest), which gave no usefull results. Later,
me and ow3n tried (and told OneOfOne and sn4ip3r from #love-sources) to run
`hald --daemon=no`, and normal hald daemon with `dbus-monitor --system`
(jay, dbus-monitor actually works now).
These are the results:
1. My reader, 10 years old dunno-what-model-or-brand:
- when running my testprog: no output on eject pressing
- when running hald --daemon=no: after all listings, I get
[E] linux/block_class_device.c:496 detect_media() :
GPCMD_GET_EVENT_STATUS_NOTIFICATION failed, errno=5
every x seconds. ow3n says this is due to my reader being too
old.
- dbus-monitor gives valuable no output
2. ow3n's reader #1
- (didnt try)
- same error as me
- no output on eject pressing
Too old too propably
3. ow3n's reader #2
- (didnt try)
- no error!!!
- no output on eject either. Lazy reader? Seems to be a newer
model tough (DVD reader)
4. sn4ip3r's reader
- No valuable output
- No error
- no output on eject. Lazy one too?
5. OneOfOne's output
- Didnt run
- No error
- Output!!!!
signal interface=org.freedesktop.Hal.Device;
member=Condition; sender=:1.10
string:EjectPressed
string:/dev/hdc
So it *seems* to be working on some models (well, found one ;-)): samsung
cd-rw SW-252
Conclusion: I hope there's another way to get this working, writing software
which only works on one reader out of 5 (ok, drop mine, one out of 4) is not
really user-friendly :-s
Ow3n tought the problem could be due to (and I quote) "the current test
using the GPCMD_GET_EVENT_STATUS_NOTIFICATION command doesn't seem to catch
the eject request even though the ioctl succeeds." Don't ask me, I'm no
hardware expert ;-)
Regards, Ikke
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list