summaryrefslogtreecommitdiff
path: root/usb/MonitorFfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'usb/MonitorFfs.cpp')
-rw-r--r--usb/MonitorFfs.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/usb/MonitorFfs.cpp b/usb/MonitorFfs.cpp
index dc25aba..717e6a7 100644
--- a/usb/MonitorFfs.cpp
+++ b/usb/MonitorFfs.cpp
@@ -26,7 +26,7 @@ namespace usb {
static volatile bool gadgetPullup;
-MonitorFfs::MonitorFfs(const char *const gadget, const char *const extconUsbState)
+MonitorFfs::MonitorFfs(const char *const gadget)
: mWatchFd(),
mEndpointList(),
mLock(),
@@ -37,7 +37,6 @@ MonitorFfs::MonitorFfs(const char *const gadget, const char *const extconUsbStat
mCallback(NULL),
mPayload(NULL),
mGadgetName(gadget),
- mExtconUsbState(extconUsbState),
mMonitorRunning(false) {
unique_fd eventFd(eventfd(0, 0));
if (eventFd == -1) {
@@ -119,7 +118,6 @@ void *MonitorFfs::startMonitorFd(void *param) {
bool writeUdc = true, stopMonitor = false;
struct epoll_event events[kEpollEvents];
steady_clock::time_point disconnect;
- std::string usb_state;
bool descriptorWritten = true;
for (int i = 0; i < static_cast<int>(monitorFfs->mEndpointList.size()); i++) {
@@ -129,17 +127,8 @@ void *MonitorFfs::startMonitorFd(void *param) {
}
}
- if (ReadFileToString(monitorFfs->mExtconUsbState, &usb_state))
- usb_state = Trim(usb_state);
- else
- usb_state = TYPEC_GADGET_MODE_ENABLE;
-
// notify here if the endpoints are already present.
- if (usb_state == TYPEC_GADGET_MODE_DISABLE) {
- gadgetPullup = false;
- writeUdc = false;
- ALOGI("pending GADGET pulled up due to USB disconnected");
- } else if (descriptorWritten) {
+ if (descriptorWritten) {
usleep(kPullUpDelay);
if (!!WriteStringToFile(monitorFfs->mGadgetName, PULLUP_PATH)) {
lock_guard<mutex> lock(monitorFfs->mLock);
@@ -183,17 +172,7 @@ void *MonitorFfs::startMonitorFd(void *param) {
}
}
- if (ReadFileToString(monitorFfs->mExtconUsbState, &usb_state))
- usb_state = Trim(usb_state);
- else
- usb_state = TYPEC_GADGET_MODE_ENABLE;
-
- if (usb_state == TYPEC_GADGET_MODE_DISABLE) {
- if (kDebug)
- ALOGI("pending GADGET pulled up due to USB disconnected");
- gadgetPullup = false;
- writeUdc = false;
- } else if (!descriptorPresent && !writeUdc) {
+ if (!descriptorPresent && !writeUdc) {
if (kDebug)
ALOGI("endpoints not up");
writeUdc = true;