linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
Date: Thu, 08 Sep 2005 19:18:34 +0000	[thread overview]
Message-ID: <20050908191834.GA2430@vrfy.org> (raw)
In-Reply-To: <200509081443.29756.thomasheinz@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

On Thu, Sep 08, 2005 at 05:38:22PM +0200, Thomas Heinz wrote:
> Unfortunately, a similar problem occurs with my SCSI CD-RW drive. It is 
> caused by the rule:
> 
> BUS=="scsi",    KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id 
> --export $tempnode"
> 
> Now in this case, it is really about a "cdrom". The message seems to be 
> from drivers/scsi/scsi_ioctl.c. Interestingly, my other SCSI "cdrom" (in 
> fact a DVD-RAM drive) does not cause such a warning.
> 
> What is your suggestion?

Can you try this patch? Only a wild guess that it may help...

Kay

[-- Attachment #2: cdrom_id-01.patch --]
[-- Type: text/plain, Size: 1016 bytes --]

diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -36,6 +36,8 @@
  * with all of the DVD flags.  So we just include our own, aren't
  * we so nice...
  */
+#define CDO_USE_FFLAGS		0x4	/* use O_NONBLOCK information on open */
+#define CDROM_SET_OPTIONS	0x5320	/* Set behavior options */
 #define CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
 
 /* capability flags used with the uniform CD-ROM driver */
@@ -115,14 +117,21 @@ int main(int argc, char *argv[])
 	fd = open(node, O_RDONLY|O_NONBLOCK);
 	if (fd < 0) {
 		info("unable to open '%s'", node);
-		rc = 1;
+		rc = 2;
 		goto exit;
 	}
 
+	result = ioctl(fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS);
+	if (result < 0) {
+		info("CDROM_SET_OPTIONS failed for '%s'", node);
+		rc = 3;
+		goto close;
+	}
+
 	result = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
 	if (result < 0) {
 		info("CDROM_GET_CAPABILITY failed for '%s'", node);
-		rc = 3;
+		rc = 4;
 		goto close;
 	}
 

  parent reply	other threads:[~2005-09-08 19:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
2005-09-08 14:11 ` Kay Sievers
2005-09-08 15:11 ` Thomas Heinz
2005-09-08 15:38 ` Thomas Heinz
2005-09-08 19:18 ` Kay Sievers [this message]
2005-09-08 21:26 ` Thomas Heinz
2005-09-09 11:17 ` Kay Sievers
2005-09-14 22:34 ` Thomas Heinz
2005-09-14 23:21 ` Kay Sievers
2005-09-15  7:51 ` Thomas Heinz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050908191834.GA2430@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).