#include "transport.hxx" int main(int argc,char *argv[]) { Scsi_Command cmd; unsigned char dinfo[32]; unsigned int next_track; int err; if (!cmd.associate(argv[1])) perror("can't open"), exit(1); if (cmd.umount()) perror("can't unmount"),exit(1); cmd[0]=0x51; cmd[8]=sizeof(dinfo); cmd[9]=0; if (err=cmd.transport(READ,dinfo,sizeof(dinfo))) sperror("READ DISC INFORMATION",err),exit(1); next_track = dinfo[5]|dinfo[10]<<8; page05_setup(cmd); cmd[0]=0x5B; cmd[1]=0x1; cmd[2]=0x1; cmd[4]=next_track>>8; cmd[5]=next_track; cmd[9]=0; if (err=cmd.transport()) sperror("CLOSE TRACK",err),exit(1); if (wait_for_unit(cmd)) exit(1); while (1) { cmd[0]=0x5B; cmd[1]=0x1; cmd[2]=0x2; cmd[9]=0; err = cmd.transport(); if (err == 0x20407) // "OP IN PROGRESS" { poll(NULL,0,333); continue; } else if (err) sperror("CLOSE SESSION",err),exit(1); break; } wait_for_unit(cmd); pioneer_stop(cmd); }