From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: [PATCH 1/5] scsi-disk: removable hard disks support START/STOP Date: Mon, 16 Jul 2012 16:25:52 +0200 Message-ID: <1342448756-7582-2-git-send-email-pbonzini@redhat.com> References: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> Cc: kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from mail-yw0-f46.google.com ([209.85.213.46]:46486 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753325Ab2GPO0L (ORCPT ); Mon, 16 Jul 2012 10:26:11 -0400 Received: by yhmm54 with SMTP id m54so5327936yhm.19 for ; Mon, 16 Jul 2012 07:26:10 -0700 (PDT) In-Reply-To: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Support for START/STOP UNIT right now is limited to CD-ROMs. This is wrong, since removable hard disks (in the real world: SD card readers) also support it in pretty much the same way. Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index bcec66b..42bae3b 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1251,7 +1251,7 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r) bool start = req->cmd.buf[4] & 1; bool loej = req->cmd.buf[4] & 2; /* load on start, eject on !start */ - if (s->qdev.type == TYPE_ROM && loej) { + if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) && loej) { if (!start && !s->tray_open && s->tray_locked) { scsi_check_condition(r, bdrv_is_inserted(s->qdev.conf.bs) -- 1.7.10.4