$NetBSD: patch-ae,v 1.8 2008/02/15 16:23:09 gdt Exp $

--- changer-src/scsi-changer-driver.c.orig	2007-05-04 07:39:04.000000000 -0400
+++ changer-src/scsi-changer-driver.c
@@ -372,6 +372,18 @@ ChangerCMD_T ChangerIO[] = {
    NoBarCode,
    GenericSearch,
    GenericSenseHandler},
+  {"SDLT320",
+   "DLT Tape [SDLT320]",
+   DoNothing3,
+   DoNothing2,
+   DoNothing1,
+   DoNothing0,
+   DLT4000Eject,
+   GenericClean,
+   GenericRewind,
+   GenericBarCode,
+   GenericSearch,
+   GenericSenseHandler},
   {"DLT8000",
    "DLT Tape [DLT8000]",
    DoNothing3,
@@ -1488,13 +1500,14 @@ BarCode(
 {
   int ret;
   extern OpenFiles_T *pDev;
+  extern changer_t chg;         /* Needed for the infos about havebarcode */
 
   DebugPrint(DEBUG_INFO, SECTION_BARCODE,"##### START BarCode\n");
   DebugPrint(DEBUG_INFO, SECTION_BARCODE,"%-20s : fd %d\n", "BarCode", fd);
 
   DebugPrint(DEBUG_INFO, SECTION_BARCODE,"Ident = [%s], function = [%s]\n", pDev[fd].ident,
 	     pDev[fd].functions->ident);
-  ret = pDev[fd].functions->function_barcode(fd);
+  ret = (pDev[fd].functions->function_barcode(fd) | changer->havebarcode);
   DebugPrint(DEBUG_INFO, SECTION_BARCODE,"##### STOP BarCode (%d)\n",ret);
   return(ret);
 }
@@ -4068,7 +4081,7 @@ GetElementStatus(
                                      (u_char)barcode,
                                      V2(pEAAPage->MediumTransportElementAddress),
                                      (MTE + (size_t)1),
-				     SIZEOF(MediumTransportElementDescriptor_T),
+				     0, /* let the buffer auto-size */
                                      &DataBuffer) != 0)
             {
               ChgExit("genericElementStatus","Can't read MTE status", FATAL);
@@ -4153,7 +4166,7 @@ GetElementStatus(
                                      (u_char)barcode,
                                      V2(pEAAPage->FirstStorageElementAddress),
                                      STE,
-				     SIZEOF(StorageElementDescriptor_T),
+				     0, /* let the buffer auto-size */
                                      &DataBuffer) != 0)
             {
               ChgExit("GetElementStatus", "Can't read STE status", FATAL);
@@ -4239,7 +4252,7 @@ GetElementStatus(
                                      (u_char)barcode,
                                      V2(pEAAPage->FirstImportExportElementAddress),
                                      IEE,
-				     SIZEOF(ImportExportElementDescriptor_T),
+				     0, /* let the buffer auto-size */
                                      &DataBuffer) != 0)
             {
               ChgExit("GetElementStatus", "Can't read IEE status", FATAL);
@@ -4323,7 +4336,7 @@ GetElementStatus(
                                      (u_char)barcode,
                                      V2(pEAAPage->FirstDataTransferElementAddress),
                                      DTE,
-				     SIZEOF(DataTransferElementDescriptor_T),
+				     0, /* let the buffer auto-size */
                                      &DataBuffer) != 0)
             {
               ChgExit("GenericElementStatus", "Can't read DTE status", FATAL);
