diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-26 23:01:49 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-26 23:01:49 +0000 |
commit | 899eff32e423709476b686fe3dbefd701357c475 (patch) | |
tree | cce5bd365945396ac9f3ae94a4990544df43f510 | |
parent | d1c620922395229002e9f0b98521d45d5100a49a (diff) | |
parent | c7d913decebad94997a2be932ac7f3341ace5153 (diff) | |
download | gs101-899eff32e423709476b686fe3dbefd701357c475.tar.gz |
Snap for 8650219 from c7d913decebad94997a2be932ac7f3341ace5153 to tm-d1-release
Change-Id: I5d43095276124951923157e74ad29cdb3a449ba2
-rw-r--r-- | conf/init.gs101.rc | 9 | ||||
-rw-r--r-- | usb/usb/Usb.cpp | 31 |
2 files changed, 30 insertions, 10 deletions
diff --git a/conf/init.gs101.rc b/conf/init.gs101.rc index 7b241f3f..bf63c26f 100644 --- a/conf/init.gs101.rc +++ b/conf/init.gs101.rc @@ -985,10 +985,19 @@ on property:vendor.thermal.link_ready=1 chown system system /dev/thermal/cdev-by-name/wlc_fcc/cur_state chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state +# Create thermal symlink in off charging mode on charger + mkdir /dev/thermal 0750 system system + mkdir /dev/thermal/tz-by-name 0750 system system + mkdir /dev/thermal/cdev-by-name 0750 system system + start vendor.thermal.symlinks write /proc/vendor_sched/sys_uclamp_min 0 write /proc/vendor_sched/sys_prefer_idle 0 +# Launch thermal hal in off charging mode +on charger && property:vendor.thermal.link_ready=1 + start vendor.thermal-hal-2-0 + on property:vendor.disable.bcl.control=1 write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0 diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index b8ad7c5f..6cff2f26 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -83,23 +83,39 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int64_t in_transactionId) { bool result = true; std::vector<PortStatus> currentPortStatus; + string pullup; ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off", in_transactionId); if (in_enable) { if (!mUsbDataEnabled) { - if (!WriteStringToFile("1", USB_DATA_PATH)) { - ALOGE("Not able to turn on usb connection notification"); - result = false; + if (ReadFileToString(PULLUP_PATH, &pullup)) { + pullup = Trim(pullup); + if (pullup != kGadgetName) { + if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) { + ALOGE("Gadget cannot be pulled up"); + result = false; + } + } } - if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) { - ALOGE("Gadget cannot be pulled up"); + if (!WriteStringToFile("1", USB_DATA_PATH)) { + ALOGE("Not able to turn on usb connection notification"); result = false; } } } else { + if (ReadFileToString(PULLUP_PATH, &pullup)) { + pullup = Trim(pullup); + if (pullup == kGadgetName) { + if (!WriteStringToFile("none", PULLUP_PATH)) { + ALOGE("Gadget cannot be pulled down"); + result = false; + } + } + } + if (!WriteStringToFile("1", ID_PATH)) { ALOGE("Not able to turn off host mode"); result = false; @@ -114,11 +130,6 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, ALOGE("Not able to turn on usb connection notification"); result = false; } - - if (!WriteStringToFile("none", PULLUP_PATH)) { - ALOGE("Gadget cannot be pulled down"); - result = false; - } } if (result) { |