From 47d86a35bc737710e5ca7d0498a88a980c4f047c Mon Sep 17 00:00:00 2001 From: jt1134 Date: Sun, 27 Feb 2011 18:54:09 -0600 Subject: [PATCH] option to specify usb_mass_storage device in device overlay --- Android.mk | 2 +- extendedcommands.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Android.mk b/Android.mk index 57adbde..a519307 100644 --- a/Android.mk +++ b/Android.mk @@ -31,7 +31,7 @@ LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) -BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY +BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \ $(if $($(board_define)), \ diff --git a/extendedcommands.c b/extendedcommands.c index 80849fb..0a43770 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -340,12 +340,15 @@ void show_nandroid_restore_menu() nandroid_restore(file, 1, 1, 1, 1, 1, 0); } +#ifndef BOARD_UMS_LUNFILE +#define BOARD_UMS_LUNFILE "/sys/devices/platform/usb_mass_storage/lun0/file" +#endif + void show_mount_usb_storage_menu() { int fd; Volume *vol = volume_for_path("/sdcard"); - if ((fd = open("/sys/devices/platform/usb_mass_storage/lun0/file", - O_WRONLY)) < 0) { + if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) { LOGE("Unable to open ums lunfile (%s)", strerror(errno)); return -1; } @@ -371,7 +374,7 @@ void show_mount_usb_storage_menu() break; } - if ((fd = open("/sys/devices/platform/usb_mass_storage/lun0/file", O_WRONLY)) < 0) { + if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) { LOGE("Unable to open ums lunfile (%s)", strerror(errno)); return -1; } @@ -1130,4 +1133,4 @@ void handle_chargemode() { if (strstr(file_data, "androidboot.mode=offmode_charging") != NULL) reboot(RB_POWER_OFF); - } \ No newline at end of file + }