You are not logged in.

#1 2012-02-28 22:27:34

bagheera
Member
Registered: 2009-06-13
Posts: 84

[solved] can't eject tray even if media is not mounted

I'm building htpc with arch and xbmc. Unfortunatly, xbmc can't eject cdrom tray. It can't be done even outside xbmc. I can't use button on device, even if media present on device is not mounted. Button on device is working just fine, if no media is present.

eject command is working.

[xbmc@mediacenter ~]$ eject -v
eject: using default device `sr0'
eject: device name is `sr0'
eject: expanded name is `/dev/sr0'
eject: `/dev/sr0' is not mounted
eject: `/dev/sr0' is not a mount point
eject: checking if device "/dev/sr0" has a removable or hotpluggable flag
eject: `/dev/sr0' is not a multipartition device
eject: trying to eject `/dev/sr0' using CD-ROM eject command
eject: unlocking tray using CDROM_LOCKDOOR ioctl
eject: CD-ROM eject command succeeded
[xbmc@mediacenter ~]$ 

How to configure system to be able to eject cd tray if inserted media is not mounted?
It is unacceptable state for that machine, cuz xbmc supposed to be running only xbmc with rf remote unit.

Last edited by bagheera (2012-03-02 19:51:13)


arch linux user

Offline

#2 2012-02-28 22:35:58

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] can't eject tray even if media is not mounted

It's udev that locks the tray. The instruction to do so is in /lib/udev/rules.d/60-cdrom_id.rules, you could mess with that. No idea about the consequences.

Offline

#3 2012-03-01 20:21:03

bagheera
Member
Registered: 2009-06-13
Posts: 84

Re: [solved] can't eject tray even if media is not mounted

There is not instruction in that file that i can fully understand. What i need to change exactly?

# do not edit this file, it will be overwritten on update

ACTION=="remove", GOTO="cdrom_end"
SUBSYSTEM!="block", GOTO="cdrom_end"
KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="cdrom_end"

# unconditionally tag device as CDROM
KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1"

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

# import device and media properties and lock tray to
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"

KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"

LABEL="cdrom_end"

I can't understand this behaviour. If media is mounted it shouldn't be ejected, drive is locked, that's ok, but why drive is locked even if media is NOT mounted? Isn't that a bug? It works just fine in hated/beloved ms windows...


arch linux user

Offline

#4 2012-03-01 20:29:42

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] can't eject tray even if media is not mounted

bagheera wrote:

There is not instruction in that file that i can fully understand.

That's what the comments are for.

Offline

#5 2012-03-02 11:47:41

bagheera
Member
Registered: 2009-06-13
Posts: 84

Re: [solved] can't eject tray even if media is not mounted

Well, i know that, but it's not so obvious in that particular case. I'm not going to guess from zylion possibilities.

So, should i remove  "--lock-media" from

IMPORT{program}="cdrom_id --lock-media $devnode"

arch linux user

Offline

#6 2012-03-02 14:50:43

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: [solved] can't eject tray even if media is not mounted

I don't use xbmc media center, but I found that link for Ubuntu: http://wiki.xbmc.org/index.php?title=HO … drive_lock
In Arch, that could be running under root:

# echo dev.cdrom.lock=0 >>/etc/sysctl.conf
# sysctl -p

You could try that before editing the udev rule, as that is mentioned working in Ubuntu.

Offline

#7 2012-03-02 19:50:42

bagheera
Member
Registered: 2009-06-13
Posts: 84

Re: [solved] can't eject tray even if media is not mounted

Changing

IMPORT{program}="cdrom_id --lock-media $devnode"

to

IMPORT{program}="cdrom_id $devnode"

does the trick.

Thanks for tip.


arch linux user

Offline

#8 2015-01-21 21:42:51

ambro
Member
From: Italy
Registered: 2012-08-11
Posts: 19

Re: [solved] can't eject tray even if media is not mounted

Similar issue reported in new thread:
https://bbs.archlinux.org/viewtopic.php?id=192574

Last edited by ambro (2015-01-22 10:04:45)

Offline

Board footer

Powered by FluxBB