|  | @@ -62,6 +62,39 @@ static const uint8_t CDROMAudioControlParametersPage[] =
 | 
											
												
													
														|  |  };
 |  |  };
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +// 0x2A CD-ROM Capabilities and Mechanical Status Page
 | 
											
												
													
														|  | 
 |  | +// This seems to have been standardized in MMC-1 but was de-facto present in
 | 
											
												
													
														|  | 
 |  | +// earlier SCSI-2 drives. The below mirrors one of those earlier SCSI-2
 | 
											
												
													
														|  | 
 |  | +// implementations, being is slightly shorter than the spec format but
 | 
											
												
													
														|  | 
 |  | +// otherwise returning identical information within the same bytes.
 | 
											
												
													
														|  | 
 |  | +static const uint8_t CDROMCapabilitiesPage[] =
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  | 
 |  | +0x2A, // page code
 | 
											
												
													
														|  | 
 |  | +0x0E, // page length
 | 
											
												
													
														|  | 
 |  | +0x00, // CD-R/RW reading not supported
 | 
											
												
													
														|  | 
 |  | +0x00, // CD-R/RW writing not supported
 | 
											
												
													
														|  | 
 |  | +#ifdef ENABLE_AUDIO_OUTPUT
 | 
											
												
													
														|  | 
 |  | +0x01, // byte 4: audio play supported
 | 
											
												
													
														|  | 
 |  | +#else
 | 
											
												
													
														|  | 
 |  | +0x00, // byte 4: no features supported
 | 
											
												
													
														|  | 
 |  | +#endif
 | 
											
												
													
														|  | 
 |  | +0x03, // byte 5: CD-DA ok with accurate streaming, no other features
 | 
											
												
													
														|  | 
 |  | +0x40, // byte 6: tray loader, ejection ok, but prevent/allow not supported
 | 
											
												
													
														|  | 
 |  | +#ifdef ENABLE_AUDIO_OUTPUT
 | 
											
												
													
														|  | 
 |  | +0x03, // byte 7: separate channel mute and volumes
 | 
											
												
													
														|  | 
 |  | +#else
 | 
											
												
													
														|  | 
 |  | +0x00, // byte 7: no features supported
 | 
											
												
													
														|  | 
 |  | +#endif
 | 
											
												
													
														|  | 
 |  | +0x05, 0x62, // max read speed, state (8X, ~1378KB/s)
 | 
											
												
													
														|  | 
 |  | +#ifdef ENABLE_AUDIO_OUTPUT
 | 
											
												
													
														|  | 
 |  | +0x01, 0x00,  // 256 volume levels supported
 | 
											
												
													
														|  | 
 |  | +#else
 | 
											
												
													
														|  | 
 |  | +0x00, 0x00,  // no volume levels supported
 | 
											
												
													
														|  | 
 |  | +#endif
 | 
											
												
													
														|  | 
 |  | +0x00, 0x40, // read buffer (64KB)
 | 
											
												
													
														|  | 
 |  | +0x05, 0x62, // current read speed, matching max speed
 | 
											
												
													
														|  | 
 |  | +};
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  static void pageIn(int pc, int dataIdx, const uint8_t* pageData, int pageLen)
 |  |  static void pageIn(int pc, int dataIdx, const uint8_t* pageData, int pageLen)
 | 
											
												
													
														|  |  {
 |  |  {
 | 
											
												
													
														|  |      memcpy(&scsiDev.data[dataIdx], pageData, pageLen);
 |  |      memcpy(&scsiDev.data[dataIdx], pageData, pageLen);
 | 
											
										
											
												
													
														|  | @@ -144,6 +177,25 @@ int modeSenseCDAudioControlPage(int pc, int idx, int pageCode, int* pageFound)
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +int modeSenseCDCapabilitiesPage(int pc, int idx, int pageCode, int* pageFound)
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  | 
 |  | +    if ((scsiDev.target->cfg->deviceType == S2S_CFG_OPTICAL)
 | 
											
												
													
														|  | 
 |  | +        && (pageCode == 0x2A || pageCode == 0x3F))
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        *pageFound = 1;
 | 
											
												
													
														|  | 
 |  | +        pageIn(
 | 
											
												
													
														|  | 
 |  | +            pc,
 | 
											
												
													
														|  | 
 |  | +            idx,
 | 
											
												
													
														|  | 
 |  | +            CDROMCapabilitiesPage,
 | 
											
												
													
														|  | 
 |  | +            sizeof(CDROMCapabilitiesPage));
 | 
											
												
													
														|  | 
 |  | +        return sizeof(CDROMCapabilitiesPage);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        return 0;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  extern "C"
 |  |  extern "C"
 | 
											
												
													
														|  |  int modeSelectCDAudioControlPage(int pageLen, int idx)
 |  |  int modeSelectCDAudioControlPage(int pageLen, int idx)
 | 
											
												
													
														|  |  {
 |  |  {
 |