// limitations under the License.
cc_binary {
- name: "android.hardware.usb@1.3-service.gs101",
+ name: "android.hardware.usb@1.3-service.samsung",
relative_install_path: "hw",
- init_rc: ["android.hardware.usb@1.3-service.gs101.rc"],
+ init_rc: ["android.hardware.usb@1.3-service.samsung.rc"],
vintf_fragments: [
- "android.hardware.usb@1.3-service.gs101.xml",
+ "android.hardware.usb@1.3-service.samsung.xml",
],
srcs: ["service.cpp", "Usb.cpp"],
cflags: ["-Wall", "-Werror"],
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.usb@1.3-service.gs101"
+#define LOG_TAG "android.hardware.usb@1.3-service.samsung"
#include <android-base/logging.h>
#include <android-base/properties.h>
}
}
else {
- if (!WriteStringToFile("1", ID_PATH)) {
- ALOGE("Not able to turn off host mode");
- result = false;
- }
-
- if (!WriteStringToFile("0", VBUS_PATH)) {
- ALOGE("Not able to set Vbus state");
- result = false;
- }
-
if (!WriteStringToFile("0", USB_DATA_PATH)) {
ALOGE("Not able to turn off usb connection notification");
result = false;
// Set by the signal handler to destroy the thread
volatile bool destroyThread;
-std::string enabledPath;
-constexpr char kHsi2cPath[] = "/sys/devices/platform/10d50000.hsi2c";
-constexpr char kI2CPath[] = "/sys/devices/platform/10d50000.hsi2c/i2c-";
-constexpr char kContaminantDetectionPath[] = "i2c-max77759tcpc/contaminant_detection";
-constexpr char kStatusPath[] = "i2c-max77759tcpc/contaminant_detection_status";
+bool moistureDetectionEnabled = true;
+constexpr char kContaminantDetectionPath[] = "/sys/devices/virtual/sec/ccic/water";
constexpr char kTypecPath[] = "/sys/class/typec";
-constexpr char kDisableContatminantDetection[] = "vendor.usb.contaminantdisable";
+constexpr char kDisableContaminantDetection[] = "vendor.usb.contaminantdisable";
int32_t readFile(const std::string &filename, std::string *contents) {
FILE *fp;
return -1;
}
-Status getContaminantDetectionNamesHelper(std::string *name) {
- DIR *dp;
-
- dp = opendir(kHsi2cPath);
- if (dp != NULL) {
- struct dirent *ep;
-
- while ((ep = readdir(dp))) {
- if (ep->d_type == DT_DIR) {
- if (std::string::npos != std::string(ep->d_name).find("i2c-")) {
- std::strtok(ep->d_name, "-");
- *name = std::strtok(NULL, "-");
- }
- }
- }
- closedir(dp);
- return Status::SUCCESS;
- }
-
- ALOGE("Failed to open %s", kHsi2cPath);
- return Status::ERROR;
-}
-
Status queryMoistureDetectionStatus(hidl_vec<PortStatus> *currentPortStatus_1_2) {
std::string enabled, status, path, DetectedPath;
(*currentPortStatus_1_2)[0].supportsEnableContaminantPresenceDetection = true;
(*currentPortStatus_1_2)[0].supportsEnableContaminantPresenceProtection = false;
- getContaminantDetectionNamesHelper(&path);
- enabledPath = kI2CPath + path + "/" + kContaminantDetectionPath;
- if (readFile(enabledPath, &enabled)) {
- ALOGE("Failed to open moisture_detection_enabled");
- return Status::ERROR;
- }
-
- if (enabled == "1") {
- DetectedPath = kI2CPath + path + "/" + kStatusPath;
- if (readFile(DetectedPath, &status)) {
+ if (moistureDetectionEnabled) {
+ if (readFile(kContaminantDetectionPath, &status)) {
ALOGE("Failed to open moisture_detected");
return Status::ERROR;
}
Return<void> Usb::enableContaminantPresenceDetection(const hidl_string & /*portName*/,
bool enable) {
-
- std::string disable = GetProperty(kDisableContatminantDetection, "");
+ std::string disable = GetProperty(kDisableContaminantDetection, "");
if (disable != "true")
- writeFile(enabledPath, enable ? "1" : "0");
+ moistureDetectionEnabled = enable;
hidl_vec<PortStatus> currentPortStatus_1_2;
pthread_cond_signal(&payload->usb->mPartnerCV);
pthread_mutex_unlock(&payload->usb->mPartnerLock);
} else if (!strncmp(cp, "DEVTYPE=typec_", strlen("DEVTYPE=typec_")) ||
- !strncmp(cp, "DRIVER=max77759tcpc",
- strlen("DRIVER=max77759tcpc"))) {
+ !strncmp(cp, "CCIC=WATER", strlen("CCIC=WATER"))) {
hidl_vec<PortStatus> currentPortStatus_1_2;
queryVersionHelper(payload->usb, ¤tPortStatus_1_2);
+++ /dev/null
-service vendor.usb-hal-1-3 /vendor/bin/hw/android.hardware.usb@1.3-service.gs101
- class hal
- user system
- group system shell mtp wakelock
- capabilities WAKE_ALARM BLOCK_SUSPEND
-
-on post-fs
- chown root system /sys/class/typec/port0/power_role
- chown root system /sys/class/typec/port0/data_role
- chown root system /sys/class/typec/port0/port_type
- chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/contaminant_detection
- chown root system /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/contaminant_detection
- chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
- chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
- chown root system /sys/devices/platform/11110000.usb/usb_data_enabled
- chmod 664 /sys/class/typec/port0/power_role
- chmod 664 /sys/class/typec/port0/data_role
- chmod 664 /sys/class/typec/port0/port_type
- chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
- chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
- chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled