usb: limit the current to 1.3A when connect to accessory
For imporve USB stability, limit the current to 1.3A,
when connect to accessory.
Bug: 206635552
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I2c1091aa7111e6242cc949923fbc86f27e54e976
diff --git a/usb/gadget/UsbGadget.h b/usb/gadget/UsbGadget.h
index f89476d..8a2f7fd 100644
--- a/usb/gadget/UsbGadget.h
+++ b/usb/gadget/UsbGadget.h
@@ -86,6 +86,13 @@
#define BIG_CORE "6"
#define MEDIUM_CORE "4"
+#define POWER_SUPPLY_PATH "/sys/class/power_supply/usb/"
+#define USB_PORT0_PATH "/sys/class/typec/port0/"
+
+#define CURRENT_MAX_PATH POWER_SUPPLY_PATH "current_max"
+#define CURRENT_USB_TYPE_PATH POWER_SUPPLY_PATH "usb_type"
+#define CURRENT_USB_POWER_OPERATION_MODE_PATH USB_PORT0_PATH "power_operation_mode"
+
struct UsbGadget : public IUsbGadget {
UsbGadget();