adb: Do not signal gaget stack unless descriptors are written

While recovering from endpoint errors, the gadget stack was being
signalled even when desriptors were NOT being rewritten. Avoid this
as this might cause enumeration loops.

Bug: 36036550
Change-Id: Iff2b2fc8cded001ef3c77dc170dce3b96848970c
This commit is contained in:
Badhri Jagan Sridharan 2017-03-07 17:30:03 -08:00
parent 5811a434fc
commit 43fd1a4ea7
1 changed files with 2 additions and 1 deletions

View File

@ -283,6 +283,8 @@ bool init_functionfs(struct usb_handle* h) {
D("[ %s: writing strings failed: errno=%d]", USB_FFS_ADB_EP0, errno);
goto err;
}
//Signal only when writing the descriptors to ffs
android::base::SetProperty("sys.usb.ffs.ready", "1");
}
h->bulk_out = adb_open(USB_FFS_ADB_OUT, O_RDWR);
@ -358,7 +360,6 @@ static void usb_ffs_open_thread(void* x) {
}
std::this_thread::sleep_for(1s);
}
android::base::SetProperty("sys.usb.ffs.ready", "1");
D("[ usb_thread - registering device ]");
register_usb_transport(usb, 0, 0, 1);