/*
* Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int64_t in_transactionId) {
std::vector<PortStatus> currentPortStatus;
+ bool result = true;
pthread_mutex_lock(&mLock);
+ if (!WriteStringToFile(in_enable ? "1" : "0", USB_DATA_PATH)) {
+ ALOGE("Not able to turn %s usb connection notification", in_enable ? "on" : "off");
+ result = false;
+ }
+
if (mCallback != NULL) {
ScopedAStatus ret = mCallback->notifyEnableUsbDataStatus(
- in_portName, true, in_enable ? Status::SUCCESS : Status::ERROR, in_transactionId);
+ in_portName, true, result ? Status::SUCCESS : Status::ERROR, in_transactionId);
if (!ret.isOk())
ALOGE("notifyEnableUsbDataStatus error %s", ret.getDescription().c_str());
} else {
/*
* Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Having a margin of ~3 secs for the directory and other related bookeeping
// structures created and uvent fired.
#define PORT_TYPE_TIMEOUT 8
+#define USB_DATA_PATH "/sys/devices/virtual/usb_notify/usb_control/usb_data_enabled"
namespace aidl {
namespace android {
class hal
user system
group system
+
+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/virtual/sec/ccic/water
+ chown root system /sys/devices/virtual/usb_notify/usb_control/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/virtual/usb_notify/usb_control/usb_data_enabled