int get_disc_type (int fd) { ScsiCommand *cmd; int retval = -1; unsigned char header[8]; // unsigned char disc_info[32]; // int blank=0, erasable=0; cmd = scsi_command_new_from_fd (fd); scsi_command_init (cmd, 0, 0x46); scsi_command_init (cmd, 1, 1); scsi_command_init (cmd, 8, 8); scsi_command_init (cmd, 9, 0); if (scsi_command_transport (cmd, READ, header, 8)) { /* GET CONFIGURATION failed */ scsi_command_free (cmd); return -1; } retval = (header[6]<<8)|(header[7]); /* Eingefügt von Uli scsi_command_init (cmd, 0, 0x51); // READ DISC INFORMATION scsi_command_init (cmd, 8, sizeof(disc_info)); scsi_command_init (cmd, 9, 0); if (scsi_command_transport (cmd, READ, disc_info,sizeof(disc_info))) { scsi_command_free (cmd); return -1; } // see if it's blank media if ((disc_info[2]&3) == 0) blank=0x10000; if (!retval ) { /* if the profile has not yet been set, we're dealing with an older * CD-R or CD-RW burner (which doesn't know the GET CONFIGURATION * command. Do some digging into the disc type to figure out what's * in the drive *//* erasable = ((disc_info[2] & 16)); if (blank && !erasable) { retval = 0x09; /* CD-R *//* } else if (erasable) { retval = 0x0a; /* CD-RW *//* } else if (disc_info[8] == 0x00) { retval = 0x08; /* Commercial CDs and Audio CD *//* } else { scsi_command_free (cmd); return -1; } } */ scsi_command_free (cmd); return retval; }