summaryrefslogtreecommitdiffstats
path: root/mtp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-09-11 15:28:51 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-09-11 15:28:51 +0200
commita1f38054c7eb48b03a55d1559190637238d88fe1 (patch)
treea7e493b553cf3d3790b56317792f0a466871e5fd /mtp
parentMTP: fix some code paths (diff)
downloadandroid_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar.gz
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar.bz2
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar.lz
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar.xz
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.tar.zst
android_bootable_recovery-a1f38054c7eb48b03a55d1559190637238d88fe1.zip
Diffstat (limited to '')
-rwxr-xr-xmtp/Android.mk5
-rwxr-xr-xmtp/mtp_MtpServer.cpp6
2 files changed, 9 insertions, 2 deletions
diff --git a/mtp/Android.mk b/mtp/Android.mk
index ebf1a6d36..683999d31 100755
--- a/mtp/Android.mk
+++ b/mtp/Android.mk
@@ -30,6 +30,11 @@ LOCAL_SRC_FILES = \
mtp_MtpDatabase.cpp \
node.cpp
LOCAL_SHARED_LIBRARIES += libz libc libusbhost libstdc++ libstlport libdl libcutils libutils
+
+ifneq ($(TW_MTP_DEVICE),)
+ LOCAL_CFLAGS += -DUSB_MTP_DEVICE=$(TW_MTP_DEVICE)
+endif
+
include $(BUILD_SHARED_LIBRARY)
# Build twrpmtp binary / executable
diff --git a/mtp/mtp_MtpServer.cpp b/mtp/mtp_MtpServer.cpp
index af80f6826..9df564ffc 100755
--- a/mtp/mtp_MtpServer.cpp
+++ b/mtp/mtp_MtpServer.cpp
@@ -47,11 +47,13 @@ void twmtp_MtpServer::set_storages(storages* mtpstorages) {
int twmtp_MtpServer::setup()
{
- #define USB_MTP_DEVICE "/dev/mtp_usb"
usePtp = false;
MyMtpDatabase* mtpdb = new MyMtpDatabase();
#ifdef USB_MTP_DEVICE
- int fd = open(USB_MTP_DEVICE, O_RDWR);
+#define STRINGIFY(x) #x
+#define EXPAND(x) STRINGIFY(x)
+ MTPI("Using '%s' for MTP device.\n", EXPAND(USB_MTP_DEVICE));
+ int fd = open(EXPAND(USB_MTP_DEVICE), O_RDWR);
#else
int fd = open("/dev/mtp_usb", O_RDWR);
#endif