Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.1 /drivers/ide/ide-cd.c

Filename:/drivers/ide/ide-cd.c
Lines Added:14
Lines Deleted:23
Also changed in: (Previous) 2.4.1-pre12  2.4.0  2.4.0-prerelease  2.4.0-test12  2.4.0-test8  2.4.0-test5 
(Following) 2.4.1-ac2  2.4.1-ac3  2.4.1-ac4  2.4.1-ac5  2.4.1-ac6  2.4.1-ac7 

Location
[  2.4.1
  [  drivers
    [  ide
       o  ide-cd.c

Patch

diff -u --recursive --new-file v2.4.0/linux/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- v2.4.0/linux/drivers/ide/ide-cd.c   Tue Jan  2 16:59:17 2001
+++ linux/drivers/ide/ide-cd.c   Sun Jan 28 13:37:50 2001
@@ -288,6 +288,9 @@
  * 4.59  Aug 11, 2000   - Fix changer problem in cdrom_read_toc, we weren't
  *           correctly sensing a disc change.
  *         - Rearranged some code
+ *         - Use extended sense on drives that support it for
+ *           correctly reporting tray status -- from
+ *           Michael D Johnson <johnsom@orst.edu>
  *
  *************************************************************************/
  
@@ -759,16 +762,13 @@
  * changed 5 parameters to 3 for dvd-ram
  * struct packet_command *pc; now packet_command_t *pc;
  */
-#undef CLASSIC_PACKET_STRUCT
 static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
                  struct packet_command *pc,
                  ide_handler_t *handler)
 {
-#ifdef CLASSIC_PACKET_STRUCT
    unsigned char *cmd_buf   = pc->c;
    int cmd_len      = sizeof(pc->c);
    unsigned int timeout   = pc->timeout;
-#endif
    ide_startstop_t startstop;
 
    if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
@@ -786,22 +786,10 @@
    }
 
    /* Arm the interrupt handler. */
-#ifdef CLASSIC_PACKET_STRUCT
-   /* Arm the interrupt handler. */
    ide_set_handler (drive, handler, timeout, cdrom_timer_expiry);
 
    /* Send the command to the device. */
    atapi_output_bytes (drive, cmd_buf, cmd_len);
-#else /* !CLASSIC_PACKET_STRUCT */
-   /* Arm the interrupt handler. */
-//   ide_set_handler (drive, handler, (unsigned int) pc->timeout, cdrom_timer_expiry);
-   ide_set_handler (drive, handler, pc->timeout, cdrom_timer_expiry);
-
-   /* Send the command to the device. */
-//   atapi_output_bytes (drive, (void *)pc->c, (unsigned int) sizeof(pc->c));
-   atapi_output_bytes (drive, pc->c, sizeof(pc->c));
-#endif /* CLASSIC_PACKET_STRUCT */
-
    return ide_started;
 }
 
@@ -1884,9 +1872,6 @@
       If it is, just return. */
    (void) cdrom_check_status(drive, sense);
 
-   if (CDROM_STATE_FLAGS(drive)->toc_valid)
-      return 0;
-
    /* First read just the header, so we know how long the TOC is. */
    stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr,
                 sizeof(struct atapi_toc_header), sense);
@@ -2324,11 +2309,17 @@
           sense.ascq == 0x04)
          return CDS_DISC_OK;
 
+
+      /*
+       * If not using Mt Fuji extended media tray reports,
+       * just return TRAY_OPEN since ATAPI doesn't provide
+       * any other way to detect this...
+       */
       if (sense.sense_key == NOT_READY) {
-         /* ATAPI doesn't have anything that can help
-            us decide whether the drive is really
-            emtpy or the tray is just open. irk. */
-         return CDS_TRAY_OPEN;
+         if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
+            return CDS_NO_DISC;
+         else
+            return CDS_TRAY_OPEN;
       }
 
       return CDS_DRIVE_NOT_READY;
@@ -2597,7 +2588,7 @@
    if (CDROM_CONFIG_FLAGS (drive)->dvd_r|CDROM_CONFIG_FLAGS (drive)->dvd_ram)
            printk (" DVD%s%s", 
            (CDROM_CONFIG_FLAGS (drive)->dvd_r)? "-R" : "", 
-           (CDROM_CONFIG_FLAGS (drive)->dvd_ram)? "AM" : "");
+           (CDROM_CONFIG_FLAGS (drive)->dvd_ram)? "-RAM" : "");
 
         if (CDROM_CONFIG_FLAGS (drive)->cd_r|CDROM_CONFIG_FLAGS (drive)->cd_rw) 
            printk (" CD%s%s", 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.