Transfer /dev/mtp_usb fd ownership when instancing MtpDevHandle

/dev/mtp_usb was opened before instancing MtpDevHandle, the existing fd
should be passed in otherwise MtpDevHandle::start would be blocked as it
attempted to open the device twice.

Change-Id: I6afc5b6926930dad77aceac2f6a00e1c6759a883
This commit is contained in:
dianlujitao
2019-03-28 15:04:42 +08:00
parent 0ef6492518
commit 95244dd6c0
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -33,8 +33,9 @@
constexpr char mtp_dev_path[] = "/dev/mtp_usb";
MtpDevHandle::MtpDevHandle()
: mFd(-1) {};
MtpDevHandle::MtpDevHandle(int controlFd) {
mFd.reset(controlFd);
}
MtpDevHandle::~MtpDevHandle() {}