diff --git a/Quake/cd_sdl.c b/Quake/cd_sdl.c index 32cd48f6..3f5a20c0 100644 --- a/Quake/cd_sdl.c +++ b/Quake/cd_sdl.c @@ -61,6 +61,9 @@ static void CDAudio_Eject(void) if (!cd_handle || !enabled) return; +#ifdef __linux__ + SDL_CDStop(cd_handle); /* see CDAudio_Stop() */ +#endif if (SDL_CDEject(cd_handle) == -1) Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ()); } @@ -149,8 +152,19 @@ void CDAudio_Stop(void) if (!playing) return; +#ifdef __linux__ + /* Don't really stop, but just pause: On some devices, the CDROMSTOP + * ioctl causes any followup ioctls to fail for a considerable time. + * observed with a TSSTcorp CDW/DVD SH-M522C drive with TS05 and TS08 + * firmware versions running under a 2.6.27.25 kernel, and with a + * Samsung DVD r/w drive running under 2.6.35.6 kernel. + * Therefore, avoid dead stops if playback may be resumed shortly. */ + if (SDL_CDPause(cd_handle) == -1) + Con_Printf ("CDAudio_Stop: Unable to stop CD-ROM (%s)\n", SDL_GetError()); +#else if (SDL_CDStop(cd_handle) == -1) Con_Printf ("CDAudio_Stop: Unable to stop CD-ROM (%s)\n", SDL_GetError()); +#endif wasPlaying = false; playing = false; @@ -563,6 +577,9 @@ void CDAudio_Shutdown(void) CDAudio_Stop(); if (hw_vol_works) CD_SetVolume (NULL); /* no SDL support at present. */ +#ifdef __linux__ + SDL_CDStop(cd_handle); /* see CDAudio_Stop() */ +#endif SDL_CDClose(cd_handle); cd_handle = NULL; cd_dev = -1;