From a7af998edf0443fb8459bf10bca3e5ed95e8b2ad Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Wed, 22 Aug 2018 23:21:43 +0300 Subject: [PATCH] [usb_moded] Reject mtp_mode if mtp daemon can't be started Gadget is programmed according to mtp_mode requirements regardless of availability of mtp daemon - which leaves non-functional mtp_mode supposedly active. Switch to fallback mode if mtp daemon can't be started. Signed-off-by: Simo Piiroinen --- src/usb_moded.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/usb_moded.c b/src/usb_moded.c index a35f99a..52fdc4e 100644 --- a/src/usb_moded.c +++ b/src/usb_moded.c @@ -613,8 +613,10 @@ static void usbmoded_switch_to_mode(const char *mode) * as they will use the usbmoded_get_usb_mode_data function */ usbmoded_set_usb_mode_data(data); - if( usbmoded_mode_is_mtp_mode(mode) ) - usbmoded_start_mtpd(); + if( usbmoded_mode_is_mtp_mode(mode) ) { + if( !usbmoded_start_mtpd() ) + goto FAILED; + } if( !usbmoded_set_usb_module(data->mode_module) ) goto FAILED;