From 750ce667899ec90612308c966160f74d947e3ae8 Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Wed, 6 Jul 2016 16:43:01 +0300 Subject: [PATCH] [android] Make sure android usb is enabled on usb-moded startup. JB#35683 If android usb is in enable=0 state, cable detection is persistently broken as the existing workarounds in usb-moded are made when cable disconnect is detected and that can't happen unless cable detect works. Enable android usb on usb-moded startup. Signed-off-by: Simo Piiroinen --- src/usb_moded-android.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/usb_moded-android.c b/src/usb_moded-android.c index 565cadc..d0dafb9 100644 --- a/src/usb_moded-android.c +++ b/src/usb_moded-android.c @@ -81,6 +81,10 @@ void android_init_values(void) } /* For rndis to be discovered correctly in M$ Windows (vista and later) */ write_to_file("/sys/class/android_usb/f_rndis/wceis", "1"); + + /* Make sure android_usb does not stay disabled in case usb moded + * has crashed / been killed in inconvenient time. */ + write_to_file("/sys/class/android_usb/android0/enable", "1"); } /* Set a charging mode for the android gadget