From 71e736ef90ef644130201742980b275fcca259a5 Mon Sep 17 00:00:00 2001 From: San Mehat Date: Mon, 7 Dec 2009 14:26:59 -0800 Subject: qemu: android: Add control console support for managing sdcards Signed-off-by: San Mehat qemu: goldfish: Fix compile error introduced in refactoring Signed-off-by: San Mehat --- hw/goldfish_device.h | 3 ++- hw/goldfish_mmc.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'hw') diff --git a/hw/goldfish_device.h b/hw/goldfish_device.h index 7eb21de..d0739b7 100644 --- a/hw/goldfish_device.h +++ b/hw/goldfish_device.h @@ -49,7 +49,8 @@ void goldfish_battery_display(void (* callback)(void *data, const char* string), void goldfish_mmc_init(uint32_t base, int id); void goldfish_mmc_insert(int id, BlockDriverState* bs); -void goldfish_mmc_remove(int id, BlockDriverState *bs); +void goldfish_mmc_remove(int id); +int goldfish_mmc_is_media_inserted(int id); void *goldfish_switch_add(char *name, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id); void goldfish_switch_set_state(void *opaque, uint32_t state); diff --git a/hw/goldfish_mmc.c b/hw/goldfish_mmc.c index 124f865..8b5c137 100644 --- a/hw/goldfish_mmc.c +++ b/hw/goldfish_mmc.c @@ -560,18 +560,25 @@ static void goldfish_mmc_setbs(struct goldfish_mmc_state* s, BlockDriverState* b void goldfish_mmc_insert(int id, BlockDriverState* bs) { if (id >= GOLDFISH_MMC_MAX) { - fprintf(stderr, "mmc controller %d out of range\n", id); - return; + return -1; } goldfish_mmc_setbs(gDrvState[id], bs); } -void goldfish_mmc_remove(int id, BlockDriverState* bs) +int goldfish_mmc_is_media_inserted(int id) +{ + if (id > GOLDFISH_MMC_MAX) { + return -1; + } + + return (gDrvState[id]->bs != NULL); +} + +void goldfish_mmc_remove(int id) { if (id >= GOLDFISH_MMC_MAX) { - fprintf(stderr, "mmc controller %d out of range\n", id); - return; + return -1; } goldfish_mmc_setbs(gDrvState[id], NULL); -- cgit v1.1