> -     New option -immed tells cdrecord to set the SCSI "IMMED" flag in certain
>       commands.

For public amusement. Attached patch automatically engages "IMMED" flag
when appropriate. A.
*** ./cdrecord/scsi_cdr.c.orig  Thu Sep 26 02:06:44 2002
--- ./cdrecord/scsi_cdr.c       Mon Sep 30 22:18:12 2002
***************
*** 140,145 ****
--- 140,176 ----
  LOCAL void    print_speed     __PR((char *fmt, int val));
  EXPORT        void    print_capabilities __PR((SCSI *scgp));
  
+ EXPORT int
+ get_phys_interface(scgp)
+       SCSI    *scgp;
+ {
+       register struct scg_cmd *scmd = scgp->scmd;
+       unsigned char profile [16];
+ 
+       fillbytes((caddr_t)scmd, sizeof(*scmd), '\0');
+       scmd->addr = (caddr_t)profile;
+       scmd->size = sizeof(profile);
+       scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA|SCG_SILENT;
+       scmd->cdb_len = SC_G1_CDBLEN;
+       scmd->sense_len = CCS_SENSE_LEN;
+       scmd->cdb.g1_cdb.cmd = 0x46;    /* Get Configuration */
+       scmd->cdb.g1_cdb.lun = scg_lun(scgp);
+       scmd->cdb.cmd_cdb[3] = 1;       /* ask for Core Feature */
+       scmd->cdb.cmd_cdb[8] = sizeof(profile);
+ 
+       scgp->cmdname = "get configuration";
+ 
+       if (scg_cmd(scgp) < 0) return (0);
+ 
+       if (scgp->verbose)
+               scg_prbytes("Get Configuration 
+:",profile,sizeof(profile)-scg_getresid(scgp));
+ 
+       if (scg_getresid(scgp) != 0) return (0);
+ 
+       return  (profile[12]<<24) | (profile[13]<<16) |
+               (profile[14]<<8)  | (profile[15]);
+ }
+ 
  EXPORT BOOL
  unit_ready(scgp)
        SCSI    *scgp;
*** ./cdrecord/drv_mmc.c.orig   Sat Sep 28 19:37:01 2002
--- ./cdrecord/drv_mmc.c        Mon Sep 30 22:24:29 2002
***************
*** 591,596 ****
--- 591,604 ----
                        dp->cdr_flags |= CDR_BURNFREE;
        }
  
+       {       int interface=get_phys_interface(scgp);
+ 
+               if (interface==2) {     /* ATAPI */
+                       allow_atapi(scgp, TRUE);
+                       dp->cdr_cmdflags |= F_IMMED;
+               }
+       }
+ 
        if (mmc_isplextor(scgp)) {
                if (check_varirec_plextor(scgp) >= 0)
                        dp->cdr_flags |= CDR_VARIREC;
*** ./cdrecord/cdrecord.h.orig  Fri Sep 27 16:34:39 2002
--- ./cdrecord/cdrecord.h       Mon Sep 30 22:14:55 2002
***************
*** 725,730 ****
--- 725,731 ----
   * scsi_cdr.c
   */
  #ifdef        _SCG_SCSITRANSP_H
+ extern        int     get_phys_interface __PR((SCSI *scgp));
  extern        BOOL    unit_ready      __PR((SCSI *scgp));
  extern        BOOL    wait_unit_ready __PR((SCSI *scgp, int secs));
  extern        BOOL    scsi_in_progress __PR((SCSI *scgp));

Reply via email to