home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / mCD / Source / TestCD.m < prev    next >
Encoding:
Text File  |  1994-06-26  |  17.9 KB  |  657 lines

  1.  
  2. #import "TestCD.h"
  3. #import "PrefsController.h"
  4.  
  5. @implementation TestCD
  6.  
  7. - _printTestBuff
  8. {
  9.     /* call this when testBuff has one (only 1) complete line in it */
  10.     [cmdInfoText replaceSel: testBuff];
  11.     if (consolePrint) printf("mCD %s", testBuff);
  12.     testBuff[0] = '\0';                      
  13.  
  14.     return self;
  15. }
  16.  
  17. - awakeFromNib
  18. {
  19.     test_fd = 0;
  20.     [closeFdButton setEnabled:NO];
  21.     consolePrint = NO;  /* should probably set the switch status */
  22.     return self;
  23. }
  24.  
  25. - setConsolePrint:sender
  26. {
  27.     consolePrint = [sender state];
  28.     return self;
  29. }
  30.  
  31. - showUsingPrefs:mainPrefObject
  32. {
  33.     mainPrefs = mainPrefObject;
  34.     
  35.     [testCDWindow makeKeyAndOrderFront:self];
  36.     return self;
  37. }
  38.  
  39. - zOpenFd:sender
  40. {
  41.     strcpy(test_fdName, [mainPrefs rawDeviceName]);
  42.  
  43.     if ( test_fd > 0 ) close( test_fd );
  44.     test_fd = open( test_fdName, O_RDONLY );
  45.     if ( test_fd < 0 ) {
  46.     NXRunAlertPanel(0,
  47.         "Error return from open() for device %s",
  48.         0, 0, 0, test_fdName);
  49.     }
  50.     else {
  51.     [openFdButton setEnabled:NO];
  52.     [closeFdButton setEnabled:YES];
  53.     }
  54.     
  55.     return self;
  56. }
  57.  
  58. - zCloseFd:sender
  59. {
  60.  
  61.     if (test_fd > 0 ) {
  62.     close( test_fd );
  63.     test_fd = 0;
  64.     [openFdButton setEnabled:YES];
  65.     [closeFdButton setEnabled:NO];
  66.     }
  67.  
  68.     return self;
  69. }
  70.  
  71. - zPlaybackControl:sender
  72. {
  73.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  74.  
  75.     if ( test_fd == 0 ) {
  76.         sprintf (testBuff, "pb-ctrl: no open fd to test it on\n");
  77.     [self _printTestBuff];
  78.     }
  79.     else {
  80.     do_playbackvolume_c9(test_fd, [leftVolField intValue], 
  81.                       [rightVolField intValue], &test_Ereply);
  82.     }
  83.     
  84.     [cmdInfoText scrollSelToVisible];
  85.     return self;
  86. }
  87.  
  88. - zPlaybackStatus:sender
  89. {
  90.     char *audioStatusText[] = { "playing", "paused", "audio muting on", 
  91.         "play cmd completed", "error during play cmd",
  92.         "no audio play operation requested" };
  93.     char  *statMsg;
  94.  
  95.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  96.  
  97.     if ( test_fd == 0 ) {
  98.         sprintf (testBuff, "pb-stat: no open fd to test it on\n");
  99.     [self _printTestBuff];
  100.     }
  101.     else {
  102.     do_playbackstatus_c4(test_fd, &cd_playstatus, &test_Ereply);
  103.     statMsg = "*unknown status indicator*";
  104.     if ( cd_playstatus.pbs_audio_status <= PBS_ASTAT_NOREQ )
  105.              statMsg = audioStatusText[cd_playstatus.pbs_audio_status];
  106.     sprintf (testBuff,
  107.          "pb-stat: abs block = %u, %02u:%02u:%02u-%02u",
  108.          cd_playstatus.pbs_logical_block,
  109.          cd_playstatus.pbs_hour, cd_playstatus.pbs_min,
  110.          cd_playstatus.pbs_sec, cd_playstatus.pbs_frame );
  111.     [self _printTestBuff];
  112.     sprintf (testBuff,
  113.          ", audioStatus = %u (%s)\n",
  114.          cd_playstatus.pbs_audio_status, statMsg );
  115.     [self _printTestBuff];
  116.     sprintf (testBuff,
  117.          "-------: ch0-sel= %d (vol %03u)  ch1-sel= %d (vol %03u)\n",
  118.          cd_playstatus.pbs_ch0_sel,
  119.          cd_playstatus.pbs_ch0_vol,
  120.          cd_playstatus.pbs_ch1_sel,
  121.          cd_playstatus.pbs_ch1_vol );
  122.     [self _printTestBuff];
  123.     if ( 0 != (cd_playstatus.pbs_ch2_sel + cd_playstatus.pbs_ch2_vol
  124.              + cd_playstatus.pbs_ch3_sel + cd_playstatus.pbs_ch3_vol)
  125.          ) {
  126.         sprintf (testBuff,
  127.              "-------: ch2-sel= %d (vol %03u)  ch3-sel= %d (vol %03u)\n",
  128.              cd_playstatus.pbs_ch2_sel,
  129.              cd_playstatus.pbs_ch2_vol,
  130.              cd_playstatus.pbs_ch3_sel,
  131.              cd_playstatus.pbs_ch3_vol );
  132.         [self _printTestBuff];
  133.         }
  134.     }
  135.     
  136.     [cmdInfoText scrollSelToVisible];
  137.     return self;
  138. }
  139.  
  140. - zModeSelect:sender
  141. {
  142.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  143.  
  144.     if ( test_fd == 0 ) {
  145.         sprintf (testBuff, "modesel: no open fd to test it on\n");
  146.     [self _printTestBuff];
  147.     }
  148.     else {
  149.     do_modeselect_pc_E(test_fd, [leftVolField intValue], 
  150.                    [rightVolField intValue], &test_Ereply);
  151.     }
  152.     
  153.     [cmdInfoText scrollSelToVisible];
  154.     return self;
  155. }
  156.  
  157. - zModeSense:sender
  158. {
  159.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  160.  
  161.     if ( test_fd == 0 ) {
  162.         sprintf (testBuff, "modesns: no open fd to test it on\n");
  163.     [self _printTestBuff];
  164.     }
  165.     else {
  166.     do_modesense_pc_E(test_fd, &test_volset, &test_Ereply);
  167.     sprintf (testBuff,
  168.          "modesns: ch0-sel= %d (vol %03u)  ch1-sel= %d (vol %03u)\n",
  169.          test_volset.ch0_sel,
  170.          test_volset.ch0_vol,
  171.          test_volset.ch1_sel,
  172.          test_volset.ch1_vol );
  173.     [self _printTestBuff];
  174.     if ( 0 != (test_volset.ch2_sel + test_volset.ch2_vol
  175.              + test_volset.ch3_sel + test_volset.ch3_vol)
  176.          ) {
  177.         sprintf (testBuff,
  178.              "-------: ch2-sel= %d (vol %03u)  ch3-sel= %d (vol %03u)\n",
  179.              test_volset.ch2_sel,
  180.              test_volset.ch2_vol,
  181.              test_volset.ch3_sel,
  182.              test_volset.ch3_vol );
  183.         [self _printTestBuff];
  184.         }
  185.     }
  186.     
  187.     [cmdInfoText scrollSelToVisible];
  188.     return self;
  189. }
  190.  
  191. - zReadSubCh1:sender
  192. {
  193. #define RSC_P1 1
  194.     char  *statMsg;
  195.     BOOL  wantMsf;
  196.     u_int holdLen, holdAbsBlock, holdRelBlock;
  197.  
  198.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  199.  
  200.     if ( test_fd == 0 ) {
  201.         sprintf (testBuff, "rsc-1: no open fd to test it on\n");
  202.     [self _printTestBuff];
  203.     }
  204.     else {
  205.         wantMsf = 1;
  206.     do_readsubchannel_42(test_fd, wantMsf, 1, RSC_P1, 0,
  207.             &cd_rscReply1, &test_Ereply);
  208.     statMsg = "*unknown status indicator*";
  209.     switch (cd_rscReply1.scr_header.sch_astatus) {
  210.        case RSC_ASTAT_PAUSED:
  211.         statMsg = "paused";
  212.         break;
  213.        case RSC_ASTAT_PLAYING:
  214.         statMsg = "playing";
  215.         break;
  216.        case RSC_ASTAT_PLAYCOMPLETE:
  217.         statMsg = "play completed";
  218.         break;
  219.        case RSC_ASTAT_PLAYABORTED:
  220.         statMsg = "play aborted";
  221.         break;
  222.        case RSC_ASTAT_NONE:
  223.         statMsg = "no status";
  224.         break;
  225.         }
  226.     holdLen = GET_2BYTE_UINT(cd_rscReply1.scr_header.sch_length);
  227.     sprintf (testBuff,
  228.          "rsc-1: dc= %u  len= %u  cntrl= %d  audioStatus= %u (%s)\n",
  229.          cd_rscReply1.u.u_scr_cur_pos.sc1_data_code,
  230.          holdLen, cd_rscReply1.u.u_scr_cur_pos.sc1_control,
  231.          cd_rscReply1.scr_header.sch_astatus, statMsg);
  232.     [self _printTestBuff];
  233.     if ( wantMsf ) {
  234.         sprintf (testBuff,
  235.             "-----: track= %u  index= %u  absaddr= %02d:%02d:%02d-%02d  reladdr= %02d:%02d:%02d-%02d\n",
  236.             cd_rscReply1.u.u_scr_cur_pos.sc1_track,
  237.             cd_rscReply1.u.u_scr_cur_pos.sc1_index,
  238.             cd_rscReply1.u.u_scr_cur_pos.sc1_abs_addr.msf.hour,
  239.             cd_rscReply1.u.u_scr_cur_pos.sc1_abs_addr.msf.min,
  240.             cd_rscReply1.u.u_scr_cur_pos.sc1_abs_addr.msf.sec,
  241.             cd_rscReply1.u.u_scr_cur_pos.sc1_abs_addr.msf.frame,
  242.             cd_rscReply1.u.u_scr_cur_pos.sc1_rel_addr.msf.hour,
  243.             cd_rscReply1.u.u_scr_cur_pos.sc1_rel_addr.msf.min,
  244.             cd_rscReply1.u.u_scr_cur_pos.sc1_rel_addr.msf.sec,
  245.             cd_rscReply1.u.u_scr_cur_pos.sc1_rel_addr.msf.frame
  246.             );
  247.         [self _printTestBuff];
  248.         }
  249.     else { /* not MSF, ie, it's LBA format */
  250.         holdAbsBlock = GET_4BYTE_UINT(cd_rscReply1.u.u_scr_cur_pos.sc1_abs_addr.lba.lblock);
  251.            holdRelBlock = GET_4BYTE_UINT(cd_rscReply1.u.u_scr_cur_pos.sc1_rel_addr.lba.lblock);
  252.         sprintf (testBuff,
  253.             "-----: track= %u  index= %u  absaddr= %u  reladdr= %u\n",
  254.             cd_rscReply1.u.u_scr_cur_pos.sc1_track,
  255.             cd_rscReply1.u.u_scr_cur_pos.sc1_index,
  256.             holdAbsBlock, holdRelBlock);
  257.         [self _printTestBuff];
  258.         }
  259.     if ( 0 != cd_rscReply1.u.u_scr_cur_pos.sc1_reserved1 ) {
  260.         sprintf (testBuff,
  261.              "-----: reserved= %d\n",
  262.              cd_rscReply1.u.u_scr_cur_pos.sc1_reserved1 );
  263.         [self _printTestBuff];
  264.         }
  265.     }
  266.     
  267.     [cmdInfoText scrollSelToVisible];
  268.     return self;
  269. }
  270.  
  271. /* Two CD's which have this field are U2's "Achtung Baby" and
  272.    "Joshua Tree" albums.  So do all the CD's in the "Led Zeppelin
  273.    Complete Studio Recordings" Box set (and all CD's in the set
  274.    have the same media number).  However it seems that *MOST* CD's
  275.    do *not* have this field filled in. */
  276. - zReadSubCh2:sender
  277. {
  278. #define RSC_P2 2
  279.     int  i;
  280.     u_int  holdLen;
  281.     u_char *cptr;
  282.  
  283.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  284.  
  285.     if ( test_fd == 0 ) {
  286.         sprintf (testBuff, "rsc-2: no open fd to test it on\n");
  287.     [self _printTestBuff];
  288.     }
  289.     else {
  290.     do_readsubchannel_42(test_fd, 1, 1, RSC_P2, 0,
  291.             &cd_rscReply2, &test_Ereply);
  292.     holdLen = GET_2BYTE_UINT(cd_rscReply2.scr_header.sch_length);
  293.     sprintf (testBuff,
  294.          "rsc-2: dc= %u  audioStatus= %u  len= %u  mcval= %d\n",
  295.          cd_rscReply2.u.u_scr_med_cat.sc2_data_code,
  296.          cd_rscReply2.scr_header.sch_astatus, holdLen,
  297.          cd_rscReply2.u.u_scr_med_cat.sc2_mcval );
  298.     [self _printTestBuff];
  299.  
  300.     sprintf (testBuff,
  301.          "-----: media catalog number (UPC)= x' ");
  302.  
  303.     cptr = &(cd_rscReply2.u.u_scr_med_cat.sc2_med_cat[0]);
  304.     for (i=0; i<15; i++) {
  305.         char  smallBuff[10] = "       ";
  306.         sprintf(smallBuff, "%.2X ", *cptr++);  /* ignore comp. warning */
  307.         strcat(testBuff, smallBuff);
  308.     }
  309.     strcat(testBuff, "'\n");
  310.     [self _printTestBuff];
  311.  
  312.     if ( 0 != (cd_rscReply2.u.u_scr_med_cat.sc2_reserved1
  313.              + cd_rscReply2.u.u_scr_med_cat.sc2_reserved2) ) {
  314.         char  smallBuff[20] = "       ";
  315.         sprintf (testBuff, "-----: res1= x' ");
  316.         cptr = &(cd_rscReply2.u.u_scr_med_cat.sc2_med_cat[0]);
  317.         for (i=0; i<3; i++) {
  318.         sprintf(smallBuff, "%.2X ", *cptr++);
  319.         strcat(testBuff, smallBuff);
  320.         }
  321.         sprintf (smallBuff, "'  res2= %d\n",
  322.              cd_rscReply2.u.u_scr_med_cat.sc2_reserved2 );
  323.         strcat(testBuff, smallBuff);
  324.         [self _printTestBuff];
  325.         }
  326.     }
  327.     
  328.     [cmdInfoText scrollSelToVisible];
  329.     return self;
  330. }
  331.  
  332. /* One CD which has these fields set for all the tracks is
  333.    U2's "Zooropa" album.  Very few CD's have these fields
  334.    (one field per track) set. */
  335. - zReadSubCh3:sender
  336. {
  337. #define RSC_P3 3
  338.     int  track_number, i;
  339.     u_int  holdLen;
  340.     u_char *cptr;
  341.  
  342.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  343.    
  344.     if ( test_fd == 0 ) {
  345.         sprintf (testBuff, "rsc-3: no open fd to test it on\n");
  346.     [self _printTestBuff];
  347.     }
  348.     else {
  349.     track_number = [trackNumField intValue];
  350.     do_readsubchannel_42(test_fd, 1, 1, RSC_P3, track_number,
  351.             &cd_rscReply3, &test_Ereply);
  352.     
  353.     holdLen = GET_2BYTE_UINT(cd_rscReply3.scr_header.sch_length);
  354.     sprintf (testBuff,
  355.          "rsc-3: dc= %u  audioStatus = %u  len=%u  track= %u\n",
  356.          cd_rscReply3.u.u_scr_isrc.sc3_data_code,
  357.          cd_rscReply3.scr_header.sch_astatus, holdLen,
  358.          cd_rscReply3.u.u_scr_isrc.sc3_track );
  359.     [self _printTestBuff];
  360.     
  361.     sprintf (testBuff,
  362.          "-----: tcval= %d  Int.StandRecCode= x' ",
  363.          cd_rscReply3.u.u_scr_isrc.sc3_tcval);
  364.  
  365.     cptr = &(cd_rscReply3.u.u_scr_isrc.sc3_isrc[0]);
  366.     for (i=0; i<15; i++) {
  367.         char  smallBuff[10] = "       ";
  368.         sprintf(smallBuff, "%.2X ", *cptr++);  /* ignore comp. warning */
  369.         strcat(testBuff, smallBuff);
  370.     }
  371.     strcat(testBuff, "'\n");
  372.     [self _printTestBuff];
  373.  
  374.     if ( 0 != (cd_rscReply3.u.u_scr_isrc.sc3_reserved1
  375.              + cd_rscReply3.u.u_scr_isrc.sc3_reserved2
  376.              + cd_rscReply3.u.u_scr_isrc.sc3_reserved3) ) {
  377.         sprintf (testBuff,
  378.              "-----: reserved fields: #1= %u  #2= %u  #3= %d\n",
  379.              cd_rscReply3.u.u_scr_isrc.sc3_reserved1,
  380.              cd_rscReply3.u.u_scr_isrc.sc3_reserved2,
  381.              cd_rscReply3.u.u_scr_isrc.sc3_reserved3);
  382.         [self _printTestBuff];
  383.         }
  384.     }
  385.     
  386.     [cmdInfoText scrollSelToVisible];
  387.     return self;
  388. }
  389.  
  390. /* referenced by some of the methods that come after it */
  391. - printSenseReply:(struct esense_reply*) snsPtr from:(char *)fromStr
  392. {
  393.     char *senseKeyText[] = { "no error to report", "recovered error",
  394.         "target not ready", "media flaw", "hardware failure",
  395.         "illegal request", "drive attention", "drive access protected",
  396.         "target aborted command", "eom, some data not transfered",
  397.         "source/media data mismatch" };
  398.  
  399.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  400.  
  401.     if ( 0 == (snsPtr->er_ibvalid + snsPtr->er_class
  402.          + snsPtr->er_code + snsPtr->er_sensekey
  403.          + snsPtr->er_addsensecode + snsPtr->er_qualifier ) ) {
  404.     sprintf (testBuff,
  405.          "SenseInfo: no error from the %s\n", fromStr);
  406.     [self _printTestBuff];
  407.     [cmdInfoText scrollSelToVisible];
  408.     return self;
  409.     }
  410.  
  411.     sprintf (testBuff,
  412.         "SenseInfo: sense returned from the %s:\n", fromStr);
  413.     [self _printTestBuff];
  414.     sprintf (testBuff,
  415.          "---------: InfoBytesValid= %d  errClass= %d  errCode= %d  SenseKey= %d (",
  416.          snsPtr->er_ibvalid, snsPtr->er_class, snsPtr->er_code,
  417.          snsPtr->er_sensekey);
  418.     if ( snsPtr->er_sensekey > SENSE_MISCOMPARE ) {
  419.     strcat(testBuff, "*unknown*");
  420.     }
  421.     else {
  422.     strcat(testBuff, senseKeyText[snsPtr->er_sensekey]);
  423.     }
  424.     strcat(testBuff, ")\n");
  425.     [self _printTestBuff];
  426.  
  427.     if ( snsPtr->er_ibvalid ) {
  428. #if    __BIG_ENDIAN__
  429.     sprintf (testBuff,
  430.          "---------: InfoBytes= x'%.2X %.6X'\n",
  431.             snsPtr->er_infomsb, snsPtr->er_info );
  432. #elif    __LITTLE_ENDIAN__
  433.     sprintf (testBuff,
  434.          "---------: InfoBytes= x'%.2X %.2X %.2X %.2X'\n",
  435.             snsPtr->er_info3, snsPtr->er_info2,
  436.             snsPtr->er_info1, snsPtr->er_info0);
  437. #else
  438. #error    SCSI command / data structures are compiler sensitive
  439. #endif
  440.     [self _printTestBuff];
  441.     }
  442.  
  443.     sprintf (testBuff,
  444.          "---------: addSenseCode= %d  addSenseQualifier= %d\n",
  445.          snsPtr->er_addsensecode,
  446.          snsPtr->er_qualifier);
  447.     [self _printTestBuff];
  448.  
  449.     [cmdInfoText scrollSelToVisible];
  450.     return self;
  451. }
  452.  
  453. - zPrintLastReqSense:sender
  454. {
  455.     [self printSenseReply: &test_Ereply from:"last command tested"];
  456.     return self;
  457. }
  458.  
  459. - zPrintMainReqSense:sender
  460. {
  461.     [self printSenseReply: [mainObject esenseReplyPtr]
  462.             from:"last main program command"];
  463.     return self;
  464. }
  465.  
  466. - zPrintMainCurPosSense:sender
  467. {
  468.     [self printSenseReply: [mainObject esenseCurPosPtr]
  469.             from:"last main program call to readcurrrentposition"];
  470.     return self;
  471. }
  472.  
  473. - zPrintMainTestUnitSense:sender
  474. {
  475.     [self printSenseReply: [mainObject esenseTestUnitPtr]
  476.             from:"last main program call to testunitready"];
  477.     return self;
  478. }
  479.  
  480. - zAllowRemoval:sender
  481. {
  482.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  483.    
  484.     if ( test_fd == 0 ) {
  485.         sprintf (testBuff, "allow: no open fd to test it on\n");
  486.     [self _printTestBuff];
  487.     }
  488.     else {
  489.     do_preventremoval_1e(test_fd, NO, &test_Ereply);
  490.     }
  491.  
  492.     [cmdInfoText scrollSelToVisible];
  493.     return self;
  494. }
  495.  
  496. - zPreventRemoval:sender
  497. {
  498.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  499.    
  500.     if ( test_fd == 0 ) {
  501.         sprintf (testBuff, "prevent: no open fd to test it on\n");
  502.     [self _printTestBuff];
  503.     }
  504.     else {
  505.     do_preventremoval_1e(test_fd, YES, &test_Ereply);
  506.     }
  507.  
  508.     [cmdInfoText scrollSelToVisible];
  509.     return self;
  510. }
  511.  
  512. - zPlayALittle:sender;
  513. {
  514.     struct pa_msf tst_start = {1, 0, 0};
  515.     struct pa_msf tst_end = {2, 0, 0};
  516.     
  517.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  518.  
  519.     if ( test_fd == 0 ) {
  520.         sprintf (testBuff, "playing: no open fd to test it on\n");
  521.     [self _printTestBuff];
  522.     }
  523.     else {
  524.     sprintf (testBuff, "playing: start %02u:%02u-%02u",
  525.             tst_start.min,
  526.             tst_start.sec, tst_start.frame);
  527.     [self _printTestBuff];
  528.     sprintf (testBuff, " - end %02u:%02u-%02u\n",
  529.             tst_end.min,
  530.             tst_end.sec, tst_end.frame);
  531.     [self _printTestBuff];
  532.     
  533.     do_playaudio_msf_47(test_fd, tst_start, tst_end, &test_Ereply);
  534.     }
  535.  
  536.     [cmdInfoText scrollSelToVisible];
  537.     return self;
  538. }
  539.  
  540. - zPausePlay:sender
  541. {
  542.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  543.    
  544.     if ( test_fd == 0 ) {
  545.         sprintf (testBuff, "pause: no open fd to test it on\n");
  546.     [self _printTestBuff];
  547.     }
  548.     else {
  549.     do_pauseaudio_4b(test_fd, YES, &test_Ereply);
  550.     }
  551.  
  552.     [cmdInfoText scrollSelToVisible];
  553.     return self;
  554. }
  555.  
  556. - zResumePlay:sender
  557. {
  558.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  559.    
  560.     if ( test_fd == 0 ) {
  561.         sprintf (testBuff, "resume: no open fd to test it on\n");
  562.     [self _printTestBuff];
  563.     }
  564.     else {
  565.     do_pauseaudio_4b(test_fd, NO, &test_Ereply);
  566.     }
  567.  
  568.     [cmdInfoText scrollSelToVisible];
  569.     return self;
  570. }
  571.  
  572. - zRezeroUnit:sender
  573. {
  574.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  575.    
  576.     if ( test_fd == 0 ) {
  577.         sprintf (testBuff, "rezerounit: no open fd to test it on\n");
  578.     [self _printTestBuff];
  579.     }
  580.     else {
  581.     do_rezerounit_01(test_fd, &test_Ereply);
  582.     }
  583.  
  584.     [cmdInfoText scrollSelToVisible];
  585.     return self;
  586. }
  587.  
  588. - zInquiryAllScsi:sender
  589. {
  590.     char *devTypeText[] = { "R/W disk", "tape", "printer", 
  591.         "processor", "write-once optical", "CD-ROM, etc",
  592.         "scanner", "optical storage", "jukebox changer",
  593.         "communication device", "graphic A", "graphic B",
  594.         "logical unit not present" };
  595.     struct inquiry_reply *mInq;
  596.     int    indx;
  597.     
  598.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  599.  
  600.     sprintf (testBuff, " NOTE: the inquiry-all operation may cause your machine\n");
  601.     [self _printTestBuff];
  602.     sprintf (testBuff, "       to \"freeze up\" for as long as a minute\n");
  603.     [self _printTestBuff];
  604.     [cmdInfoText scrollSelToVisible];
  605.  
  606.     do_inquiryall( INQ_ALL_MAX_SCSI_CNT, &test_InqAll, &test_Ereply);
  607.  
  608.     [cmdInfoText setSel: [cmdInfoText textLength] :[cmdInfoText textLength]];
  609.     sprintf (testBuff, "     inquiry_all max scsi count = %d\n",
  610.             test_InqAll.maxScsiCount );
  611.     [self _printTestBuff];
  612.  
  613.     for(indx = 0; indx < test_InqAll.maxScsiCount; indx++) {
  614.     mInq = &(test_InqAll.scsiArray[indx].inqResult);
  615.     
  616.     if ( test_InqAll.scsiArray[indx].devIoStat ) {
  617.         sprintf (testBuff,
  618.             "SCSI #%d: no device attached with this SCSI id\n",
  619.             indx );
  620.         [self _printTestBuff];
  621.         }
  622.     else {
  623.         sprintf (testBuff,
  624.                 "SCSI #%d: /dev/rsd%dh  removable= %d  devicetype= %d (%s)\n",
  625.             indx, test_InqAll.scsiArray[indx].deviceNumber,
  626.             mInq->ir_removable,
  627.             mInq->ir_devicetype, devTypeText[mInq->ir_devicetype] );
  628.         [self _printTestBuff];
  629.         sprintf (testBuff,
  630.             "---- #%d:    vendorid= %.8s  productid= %.16s  revision= %.4s\n",
  631.             indx, mInq->ir_vendorid, mInq->ir_productid,
  632.             mInq->ir_revision);
  633.         [self _printTestBuff];
  634.         sprintf (testBuff,
  635.                 "---- #%d:    qual= %d  tqual = %d - versions ISO= %d ECMA= %d ANSI= %d - fmt= %d  addlen= %d\n",
  636.             indx,
  637.             mInq->ir_qual,
  638.             mInq->ir_typequalifier, mInq->ir_isoversion,
  639.             mInq->ir_ecmaversion, mInq->ir_ansiversion,
  640.             mInq->ir_rspdatafmt, mInq->ir_addlistlen );
  641.         [self _printTestBuff];
  642.         if (mInq->ir_misc[0] != '\0') {
  643.         sprintf (testBuff,
  644.              "---- #%d:    misc info= %.28s\n",
  645.              indx, mInq->ir_misc);
  646.         [self _printTestBuff];
  647.         }
  648.         }
  649.     }        /* end for (indx =... */
  650.  
  651.     [cmdInfoText scrollSelToVisible];
  652.     return self;
  653. }
  654.  
  655.  
  656. @end
  657.