All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gioele Barabucci <dev@gioelebarabucci.com>
To: axboe@suse.de
Cc: linux-scsi@vger.kernel.org
Subject: [IDE-SCSI]problems with ioctl CDROM_DRIVE_STATUS
Date: Mon, 22 Apr 2002 19:35:14 +0200	[thread overview]
Message-ID: <200204221935.14365.dev@gioelebarabucci.com> (raw)

this simple piece of code

#define ALREADY_OPEN (ioctl(cdfd, CDROM_DRIVE_STATUS) == CDS_TRAY_OPEN)
int main() {
	int cdfd;
	int eject_or_close;

	cdfd = open("/dev/cdrom", O_RDONLY | O_NONBLOCK);
	eject_or_close =
	    ALREADY_OPEN ? CDROMCLOSETRAY : CDROMEJECT;
	ioctl(cdfd, eject_or_close);
	close(cdfd);

	return 0;
}

does not work because the ioctl always returns CDS_TRAY_OPEN, also when the 
tray is closed!

details:
kernel version: 2.4.18 vanilla
modules loaded:
  ide-scsi                7280   0 (autoclean)
  sr_mod                 12848   0 (autoclean)
  scsi_mod               50560   2 (autoclean) [ide-scsi sr_mod]
  cdrom                  26880   0 (autoclean) [sr_mod]

$ cat /proc/ide/drivers
ide-scsi version 0.9
ide-disk version 1.10

files in /proc/ide/ide1/hdd:

capacity:
2147483647

driver:
ide-scsi version 0.9

identify:
8580 0000 0000 0000 0000 0000 0000 0000
0000 0000 3456 4f32 3139 3834 3931 3733
3838 3130 3032 3130 0000 1e78 0000 563a
3030 332e 3031 4944 452d 4344 2020 5265
5772 6974 6162 6c65 2d32 7832 7836 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0b00 0000 0200 0200 0002 0000 0000
0000 0000 0000 0000 0000 0000 0007 0203
0001 007f 007f 00d0 007f 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
[ other 23 lines of zeroes ]

media:
cdrom

model:
IDE-CD ReWritable-2x2x6

settings:
name                    value           min             max             mode
----                    -----           ---             ---             ----
bios_cyl                0               0               1023            rw
bios_head               0               0               255             rw
bios_sect               0               0               63              rw
current_speed           33              0               69              rw
ide_scsi                0               0               1               rw
init_speed              33              0               69              rw
io_32bit                0               0               3               rw
keepsettings            0               0               1               rw
log                     0               0               1               rw
nice1                   1               0               1               rw
number                  3               0               3               rw
pio_mode                write-only      0               255             w
slow                    0               0               1               rw
transform               1               0               3               rw
unmaskirq               0               0               1               rw
using_dma               1               0               1               rw


                 reply	other threads:[~2002-04-22 17:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200204221935.14365.dev@gioelebarabucci.com \
    --to=dev@gioelebarabucci.com \
    --cc=axboe@suse.de \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.