From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 17 Apr 2010 17:37:26 +0000 Subject: Re: [PATCH] cdrom_id: Fix empty drive detection for drives with an Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: linux-hotplug@vger.kernel.org On Sat, Apr 17, 2010 at 18:26, Mike Brudevold wrote: > My CD-RW drive experiences a problem in that it automatically closes > after opening if there is media in the drive.  This only happens if > there was media in the drive when it was last closed (an empty drive > stays open).  From what I can tell, this behavior is affected by the > ID_CDROM_MEDIA variable. > > This is the output of cdrom_id: > cd_profiles: current profile 0x02 > cd_profiles: profile 0x02 Right, this just means: "Removable disk" and we should ignore it. > I attached a patch that only sets ID_CDROM_MEDIA if the "READ DISC > INFORMATION" command is successful.  With this patch, the drive no > longer automatically closes. We need to set ID_CDROM_MEDIA for all cases where we set any type of media. Your 0x02 profile should not set it in that case, right. > /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ > if (!cd_media_cd_rom && (header[2] & 3) < 4) >       cd_media_state = media_status[header[2] & 3]; > > First of all, ((header[2] & 3) < 4) is by definition always true, so > I'm not sure what it is checking. Yeah, the < 4 can be removed. > But if somehow this is a valid > check, perhaps we should set cd_media in here. Yeah, we should set it there in any case. I've committed a change, that hopefully covers all that now. Thanks, Kay