Project

General

Profile

完成 #278 » 0001-feat-adbd-adbd-always-tries-to-configure-usb-gadget-.patch

余 顺, 04/22/2025 06:24 AM

View differences:

packages/modules/adb/daemon/usb.cpp
#include <android-base/parsebool.h>
#include <android-base/properties.h>
#include <android-base/thread_annotations.h>
#include <android-base/file.h>
#include <android-base/strings.h>
#include "adb_unique_fd.h"
#include "adb_utils.h"
......
bool enabled = false;
bool running = true;
while (running) {
std::string mode;
if (android::base::ReadFileToString("/sys/kernel/debug/usb/23000000.usb/mode", &mode)) {
mode = android::base::Trim(mode);
if (mode == "host") continue;
}
adb_pollfd pfd[2] = {
{ .fd = control_fd_.get(), .events = POLLIN, .revents = 0 },
{ .fd = monitor_event_fd_.get(), .events = POLLIN, .revents = 0 },
(5-5/5)