OSDN Git Service

adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
authorHemant Kumar <hemantk@codeaurora.org>
Wed, 22 May 2019 00:55:04 +0000 (17:55 -0700)
committerJosh Gao <jmgao@google.com>
Thu, 13 Jun 2019 19:38:19 +0000 (12:38 -0700)
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
Merged-In: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
(cherry picked from commit 1cbe5edbc3b02213e4061bf443dcf1ac8a7ba8bf)

adb/daemon/usb_ffs.cpp

index 07b4ba8..954e530 100644 (file)
@@ -257,6 +257,7 @@ bool open_functionfs(android::base::unique_fd* out_control, android::base::uniqu
         }
         // Signal only when writing the descriptors to ffs
         android::base::SetProperty("sys.usb.ffs.ready", "1");
+        *out_control = std::move(control);
     }
 
     bulk_out.reset(adb_open(USB_FFS_ADB_OUT, O_RDONLY));
@@ -271,7 +272,6 @@ bool open_functionfs(android::base::unique_fd* out_control, android::base::uniqu
         return false;
     }
 
-    *out_control = std::move(control);
     *out_bulk_in = std::move(bulk_in);
     *out_bulk_out = std::move(bulk_out);
     return true;