From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Krause Date: Mon, 28 Jul 2008 08:48:07 +0000 Subject: Re: cd-tray immediately closed after it has been opened Message-Id: <488D87C7.4090407@plauener.de> List-Id: References: <488CCA58.7030409@plauener.de> In-Reply-To: <488CCA58.7030409@plauener.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org David Zeuthen wrote: > On Sun, 2008-07-27 at 21:19 +0200, Christian Krause wrote: > >> Before this checkin, vol_id was only called for partitioned devices and >> so the CD tray stayed open. >> > > Probably vol_id needs to use O_NONBLOCK when opening sr devices. Does > that fix it? > Yes, indeed using a patch like this: diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 5c4e05d..3dc9f95 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) goto exit; } - fd = open(node, O_RDONLY); + fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { fprintf(stderr, "%s: error opening volume\n", node); rc = 2; fixes the problem, too. But it looks like that this is discouraged: http://gitweb.freedesktop.org/?p=hal.git;a=commit;h-ab6d1b27a160895e99f3a7111a78aff68baff3 ;-) Best regards, Christian