Changes to ide-cd for 2.4.1 are broken?
A message that is not in the archive (sent off-list or not yet received): 001801c09e3a$4a189270$653b090a@sulaco
Quoted 7 lines · Michael Johnson
Quoted 7 lines
Quoted 6 lines
You know all about this stuff, so probably I am mistaken. However, my copy of SFF8020-r2.6 everywhere has "Sense 02 ASC 3A: Medium not present" without giving subcodes to distinguish Tray Open from No Disc.
So, it seems to me that drives built to this spec will not have nonzero ASCQ.
Quoted 5 lines
Quoted 3 lines
Right, old ATAPI has 3a/02 as the only possible condition, so we can't really tell between no disc and tray open. I guess the safest is to just keep the old behaviour for !ascq and report open.
I don't understand why the current(2.4.1) behavior is a problem...
It isn't a problem, it just changed in the middle of a stable release.
[...]
Signature · 1 line
http://www.penguinpowered.com/~vii
Hi all, this is an old thread. It was started because the return value from cd info was changed in 2.4.1 in the case when the tray might be open or there simply be no disc in the drive for an IDE CD-ROM.
Quoted 1 line · John Fremlin
"Michael Johnson" <[email protected]> writes:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Right, old ATAPI has 3a/02 as the only possible condition, so we can't really tell between no disc and tray open. I guess the safest is to just keep the old behaviour for !ascq and report open.
I don't understand why the current(2.4.1) behavior is a problem...
Unfortunately changing the return code means that the generic cdrom.c code is broekn, in particular wrt to having the cdrom drive open automatically when umounted, and to close when attempted to be mounted.
(You can set this mode with "cdd auto" if you have my asm-toys installed
http://ape.n3.net/programs/linux/asm-toys
)
The following patch fixes that. I also attempted to fix up similar problems (where checking CDS_TRAY_OPEN is used to see if the tray is open, which is obviously broekn).
drivers/cdrom/cdrom.c +3 -3
@@ -515,8 +515,8 @@ int open_for_data(struct cdrom_device_inif (cdo->drive_status !=NULL ) { ret = cdo->drive_status (cdi,CDSL_CURRENT );cdinfo (CD_OPEN ,"drive_status=%d\n" , ret); -if (ret ==CDS_TRAY_OPEN ) { -cdinfo (CD_OPEN ,"the tray is open...\n" ); +if (ret ==CDS_TRAY_OPEN || ret ==CDS_NO_DISC ) { +cdinfo (CD_OPEN ,"the tray might be open...\n" );/* can/may i close it? */ if (CDROM_CAN (CDC_CLOSE_TRAY ) && cdi->options &CDO_AUTO_CLOSE ) {
@@ -622,7 +622,7 @@ int check_for_audio_disc(struct cdrom_deif (cdo->drive_status !=NULL ) { ret = cdo->drive_status (cdi,CDSL_CURRENT );cdinfo (CD_OPEN ,"drive_status=%d\n" , ret); -if (ret ==CDS_TRAY_OPEN ) { +if (ret ==CDS_TRAY_OPEN || ret ==CDS_NO_DISC ) {cdinfo (CD_OPEN ,"the tray is open...\n" );/* can/may i close it? */ if (CDROM_CAN(CDC_CLOSE_TRAY) &&
Signature · 3 lines
-- http://ape.n3.net
So, the patch you are proposing will always consider the tray open, even if it is closed. Why do you need this behavior?
Why is checking CDS_TRAY_OPEN, to see if the tray is open, broken?
The code in cdrom.c looks fine to me.
Michael
----- Original Message -----
From: "John Fremlin" <[email protected]>
To: "Michael Johnson" <[email protected]>
Cc: "Jens Axboe" <[email protected]>; <[email protected]>; "Alan Cox" <[email protected]>; <[email protected]>
Sent: Sunday, June 10, 2001 10:37 AM
Subject: Re: Changes to ide-cd for 2.4.1 are broken?
Quoted 23 lines
Hi all, this is an old thread. It was started because the return value from cd info was changed in 2.4.1 in the case when the tray might be open or there simply be no disc in the drive for an IDE CD-ROM.
Quoted 1 line · John Fremlin
"Michael Johnson" <[email protected]> writes:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Right, old ATAPI has 3a/02 as the only possible condition, so we can't really tell between no disc and tray open. I guess the safest is to just keep the old behaviour for !ascq and report open.
I don't understand why the current(2.4.1) behavior is a problem...
Unfortunately changing the return code means that the generic
cdrom.ccode is broekn, in particular wrt to having the cdrom drive open automatically when umounted, and to close when attempted to be mounted.
Quoted 9 lines
(You can set this mode with "cdd auto" if you have my asm-toys installed
http://ape.n3.net/programs/linux/asm-toys
)The following patch fixes that. I also attempted to fix up similar problems (where checking
CDS_TRAY_OPENis used to see if the tray is open, which is obviously broekn).
----------------------------------------------------------------------------
----
Quoted 5 lines
--
Quoted 4 lines · Michael Johnson
So, the patch you are proposing will always consider the tray open, even if it is closed. Why do you need this behavior?
Why is checking
CDS_TRAY_OPEN, to see if the tray is open, broken?
You broke it (I think it was you).
Quoted 1 line
The code in
cdrom.clooks fine to me.
Yes but you changed ide-cd.c to report CDS_NO_DISC if the tray might be open or there is no disc. I complained about this at the time, you may recall.
Quoted 53 lines
----- Original Message -----
From: "John Fremlin" <[email protected]>
To: "Michael Johnson" <[email protected]>
Cc: "Jens Axboe" <[email protected]>; <[email protected]>; "Alan Cox" <[email protected]>; <[email protected]>
Sent: Sunday, June 10, 2001 10:37 AM
Subject: Re: Changes to ide-cd for 2.4.1 are broken?Quoted 23 lines
Hi all, this is an old thread. It was started because the return value from cd info was changed in 2.4.1 in the case when the tray might be open or there simply be no disc in the drive for an IDE CD-ROM.
Quoted 1 line · John Fremlin
"Michael Johnson" <[email protected]> writes:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Right, old ATAPI has 3a/02 as the only possible condition, so we can't really tell between no disc and tray open. I guess the safest is to just keep the old behaviour for !ascq and report open.
I don't understand why the current(2.4.1) behavior is a problem...
Unfortunately changing the return code means that the generic
cdrom.ccode is broekn, in particular wrt to having the cdrom drive open automatically when umounted, and to close when attempted to be mounted.Quoted 9 lines
(You can set this mode with "cdd auto" if you have my asm-toys installed
http://ape.n3.net/programs/linux/asm-toys
)The following patch fixes that. I also attempted to fix up similar problems (where checking
CDS_TRAY_OPENis used to see if the tray is open, which is obviously broekn).----------------------------------------------------------------------------
----Quoted 5 lines
--
Signature · 1 line
http://ape.n3.net
[ This is a very old thread; please see [1] for a complete list and [2] for
technical details ]
Quoted 2 lines · [email protected] ("Michael Johnson") writes:
So, the patch you are proposing will always consider the tray open, even if it is closed. Why do you need this behavior?
I need the behavior to close the tray when it is open. Currently it will never by closed.
Quoted 1 line
Why is checking
CDS_TRAY_OPEN, to see if the tray is open, broken?
CDS_TRAY_OPEN will never be returned; only CDS_NO_DISC.
Quoted 1 line
The code in
cdrom.clooks fine to me.
The code there is fine. The code in ide-cd.c is broken:
| if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1)) | return CDS_NO_DISC; | else | return CDS_TRAY_OPEN;
Assuming the tray is open. Then ATAPI IDE-CD drives will have an unspecified ASCQ -- which is mostly zero (see ATAPI specification). Therefore, it will be returned CDS_NO_DISC. This is wrong; the correct result should be CDS_TRAY_OPEN because it is a more special description of the state than CDS_NO_DISC and the layers above are trusting in this value.
CDS_NO_DISC would lead to an immediate error in the open_for_data() function in cdrom.c, but CDS_TRAY_OPEN makes it possible to close the tray automatically.
This can be demonstrated by:
| [kernel <2.4.1; open tray] | $ rmmod cdrom | $ modprobe cdrom autoclose=1 | $ mount /cdrom | ... tray will be closed and the CD mounted ... | $ | | [kernel >=2.4.1; open tray] | $ rmmod cdrom | $ modprobe cdrom autoclose=0 | $ mount /cdrom | mount: No medium found | $
As you can see, the current behavior makes the 'autoclose' option effectless on "normal" IDE-CDROMs. Only special CDROMs following the Mt Fuji standard can profit from the ASCQ test.
I suggest the patch already given in [3] and will append it again.
Quoted 10 lines
Quoted 10 lines
Hi all, this is an old thread. It was started because the return value from cd info was changed in 2.4.1 in the case when the tray might be open or there simply be no disc in the drive for an IDE CD-ROM.
[...]Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Right, old ATAPI has 3a/02 as the only possible condition, so we can't really tell between no disc and tray open. I guess the safest is to just keep the old behaviour for !ascq and report open.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
I don't understand why the current(2.4.1) behavior is a problem...
Unfortunately changing the return code means that the generic
cdrom.ccode is broekn, in particular [...] to close when attempted to be mounted.
Enrico
Footnotes:
[1] http://marc.theaimsgroup.com/?t=98244733600003&w=2&r=1
[2] http://marc.theaimsgroup.com/?l=linux-kernel&m=98252992732626&w=2
[3] http://marc.theaimsgroup.com/?l=linux-kernel&m=98244720319144&w=2
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c.orig +1 -4
@@ -2319,10 +2319,7 @@* any other way to detect this... */ if (sense.sense_key ==NOT_READY ) { -if (sense.asc ==0x3a && (!sense.ascq||sense.ascq ==1 )) -return CDS_NO_DISC ; -else -return CDS_TRAY_OPEN ; +if (sense.asc ==0x3a )return CDS_TRAY_OPEN ; }return CDS_DRIVE_NOT_READY ;
Quoted 3 lines · [email protected] (Enrico Scholz) writes:
| [kernel >=2.4.1; open tray] | $ rmmod cdrom | $ modprobe cdrom autoclose=0
^ oops, should be a '1' obviously
Enrico