This makes the change HMP/QMP command on SD devices work again, after it
has been broken in commit de2c6c0536c5c5ebb6e0ce7dcfd8fa9476edab52.

Reported-by: Peter Maydell <peter.mayd...@linaro.org>
Cc: qemu-stable <qemu-sta...@nongnu.org>
Signed-off-by: Max Reitz <mre...@redhat.com>
---
 hw/sd/sd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 0751ba2..7d1e1cb 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -439,8 +439,15 @@ static void sd_cardchange(void *opaque, bool load)
     }
 }
 
+static bool sd_is_tray_open(void *opaque)
+{
+    SDState *sd = opaque;
+    return !sd->medium_inserted;
+}
+
 static const BlockDevOps sd_block_ops = {
     .change_media_cb = sd_cardchange,
+    .is_tray_open = sd_is_tray_open,
 };
 
 static const VMStateDescription sd_vmstate = {
-- 
2.6.4


Reply via email to