Snap for 9607154 from 5f6267c0b0
to udc-release
Change-Id: I4bd649d6eb87f31ec626fc6eb7764a43d181c3d3
This commit is contained in:
commit
ea7cbf1cc0
8 changed files with 128 additions and 36 deletions
|
@ -143,6 +143,9 @@
|
||||||
# AoC
|
# AoC
|
||||||
/dev/aoc 0660 system system
|
/dev/aoc 0660 system system
|
||||||
|
|
||||||
|
# AoC stats (UmfwStat)
|
||||||
|
/dev/acd-com.google.umfw_stat 0660 system system
|
||||||
|
|
||||||
# Sensors (USF)
|
# Sensors (USF)
|
||||||
/dev/acd-com.google.usf 0660 system system
|
/dev/acd-com.google.usf 0660 system system
|
||||||
/dev/acd-com.google.usf.non_wake_up 0660 system system
|
/dev/acd-com.google.usf.non_wake_up 0660 system system
|
||||||
|
|
|
@ -201,8 +201,8 @@ USES_GAUDIO := true
|
||||||
# Must match BOARD_USES_SWIFTSHADER in BoardConfig.mk
|
# Must match BOARD_USES_SWIFTSHADER in BoardConfig.mk
|
||||||
USE_SWIFTSHADER := false
|
USE_SWIFTSHADER := false
|
||||||
|
|
||||||
# Must match BOARD_USES_ANGLE in BoardConfig.mk
|
# by default, USE_ANGLE is false
|
||||||
USE_ANGLE := false
|
USE_ANGLE ?= false
|
||||||
|
|
||||||
# HWUI
|
# HWUI
|
||||||
TARGET_USES_VULKAN = true
|
TARGET_USES_VULKAN = true
|
||||||
|
@ -569,7 +569,6 @@ PRODUCT_PACKAGES += \
|
||||||
PRODUCT_PACKAGES_DEBUG += \
|
PRODUCT_PACKAGES_DEBUG += \
|
||||||
f2fs_io \
|
f2fs_io \
|
||||||
check_f2fs \
|
check_f2fs \
|
||||||
f2fsstat \
|
|
||||||
f2fs.fibmap \
|
f2fs.fibmap \
|
||||||
dump.f2fs
|
dump.f2fs
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,6 @@ Dumpstate::Dumpstate()
|
||||||
{ "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } },
|
{ "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } },
|
||||||
{ "power", [this](int fd) { dumpPowerSection(fd); } },
|
{ "power", [this](int fd) { dumpPowerSection(fd); } },
|
||||||
{ "display", [this](int fd) { dumpDisplaySection(fd); } },
|
{ "display", [this](int fd) { dumpDisplaySection(fd); } },
|
||||||
{ "led", [this](int fd) { dumpLEDSection(fd); } },
|
|
||||||
{ "pixel-trace", [this](int fd) { dumpPixelTraceSection(fd); } },
|
{ "pixel-trace", [this](int fd) { dumpPixelTraceSection(fd); } },
|
||||||
},
|
},
|
||||||
mLogSections{
|
mLogSections{
|
||||||
|
@ -521,18 +520,6 @@ void Dumpstate::dumpDevfreqSection(int fd) {
|
||||||
|
|
||||||
// Dump items related to memory
|
// Dump items related to memory
|
||||||
void Dumpstate::dumpMemorySection(int fd) {
|
void Dumpstate::dumpMemorySection(int fd) {
|
||||||
RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c",
|
|
||||||
"for d in $(ls -d /d/ion/*); do "
|
|
||||||
"if [ -f $d ]; then "
|
|
||||||
"echo --- $d; cat $d; "
|
|
||||||
"else "
|
|
||||||
"for f in $(ls $d); do "
|
|
||||||
"echo --- $d/$f; cat $d/$f; "
|
|
||||||
"done; "
|
|
||||||
"fi; "
|
|
||||||
"done"});
|
|
||||||
DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo");
|
|
||||||
DumpFileToFd(fd, "Page Pinner - longterm pin", "/sys/kernel/debug/page_pinner/buffer");
|
|
||||||
RunCommandToFd(fd, "CMA info", {"/vendor/bin/sh", "-c",
|
RunCommandToFd(fd, "CMA info", {"/vendor/bin/sh", "-c",
|
||||||
"for d in $(ls -d /d/cma/*); do "
|
"for d in $(ls -d /d/cma/*); do "
|
||||||
"echo --- $d;"
|
"echo --- $d;"
|
||||||
|
@ -585,21 +572,6 @@ void Dumpstate::dumpDisplaySection(int fd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump items related to LED
|
|
||||||
void Dumpstate::dumpLEDSection(int fd) {
|
|
||||||
struct stat buffer;
|
|
||||||
|
|
||||||
if (!PropertiesHelper::IsUserBuild()) {
|
|
||||||
if (!stat("/sys/class/leds/green", &buffer)) {
|
|
||||||
DumpFileToFd(fd, "Green LED Brightness", "/sys/class/leds/green/brightness");
|
|
||||||
DumpFileToFd(fd, "Green LED Max Brightness", "/sys/class/leds/green/max_brightness");
|
|
||||||
}
|
|
||||||
if (!stat("/mnt/vendor/persist/led/led_calibration_LUT.txt", &buffer)) {
|
|
||||||
DumpFileToFd(fd, "LED Calibration Data", "/mnt/vendor/persist/led/led_calibration_LUT.txt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Dumpstate::dumpModemLogs(int fd, const std::string &destDir) {
|
void Dumpstate::dumpModemLogs(int fd, const std::string &destDir) {
|
||||||
std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY;
|
std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY;
|
||||||
std::string modemLogHistoryDir = MODEM_LOG_HISTORY_DIRECTORY;
|
std::string modemLogHistoryDir = MODEM_LOG_HISTORY_DIRECTORY;
|
||||||
|
|
|
@ -57,7 +57,6 @@ class Dumpstate : public BnDumpstateDevice {
|
||||||
void dumpDevfreqSection(int fd);
|
void dumpDevfreqSection(int fd);
|
||||||
void dumpMemorySection(int fd);
|
void dumpMemorySection(int fd);
|
||||||
void dumpDisplaySection(int fd);
|
void dumpDisplaySection(int fd);
|
||||||
void dumpLEDSection(int fd);
|
|
||||||
void dumpPixelTraceSection(int fd);
|
void dumpPixelTraceSection(int fd);
|
||||||
|
|
||||||
void dumpLogSection(int fd, int fdModem);
|
void dumpLogSection(int fd, int fdModem);
|
||||||
|
|
|
@ -40,10 +40,12 @@ cc_binary {
|
||||||
"libbinder",
|
"libbinder",
|
||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
"liblog",
|
"liblog",
|
||||||
|
"libusbhost",
|
||||||
"libutils",
|
"libutils",
|
||||||
"libhardware",
|
"libhardware",
|
||||||
"android.hardware.thermal@1.0",
|
"android.hardware.thermal@1.0",
|
||||||
"android.hardware.thermal@2.0",
|
"android.hardware.thermal@2.0",
|
||||||
|
"android.hardware.thermal-V1-ndk",
|
||||||
"android.hardware.usb.gadget@1.0",
|
"android.hardware.usb.gadget@1.0",
|
||||||
"android.hardware.usb-V1-ndk",
|
"android.hardware.usb-V1-ndk",
|
||||||
"android.hardware.usb.gadget-V1-ndk",
|
"android.hardware.usb.gadget-V1-ndk",
|
||||||
|
@ -51,11 +53,11 @@ cc_binary {
|
||||||
"android.frameworks.stats-V1-ndk",
|
"android.frameworks.stats-V1-ndk",
|
||||||
"pixelatoms-cpp",
|
"pixelatoms-cpp",
|
||||||
"libbinder_ndk",
|
"libbinder_ndk",
|
||||||
|
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libpixelusb-aidl",
|
"libpixelusb-aidl",
|
||||||
"libpixelstats",
|
"libpixelstats",
|
||||||
|
"libpixelthermalwrapper",
|
||||||
],
|
],
|
||||||
export_shared_lib_headers: [
|
export_shared_lib_headers: [
|
||||||
"android.frameworks.stats-V1-ndk",
|
"android.frameworks.stats-V1-ndk",
|
||||||
|
|
115
usb/usb/Usb.cpp
115
usb/usb/Usb.cpp
|
@ -22,10 +22,12 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <private/android_filesystem_config.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <usbhost/usbhost.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <utils/Errors.h>
|
#include <utils/Errors.h>
|
||||||
#include <utils/StrongPointer.h>
|
#include <utils/StrongPointer.h>
|
||||||
|
#include <utils/Vector.h>
|
||||||
|
|
||||||
#include "Usb.h"
|
#include "Usb.h"
|
||||||
|
|
||||||
|
@ -48,6 +51,8 @@ using android::base::Trim;
|
||||||
using android::hardware::google::pixel::getStatsService;
|
using android::hardware::google::pixel::getStatsService;
|
||||||
using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat;
|
using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat;
|
||||||
using android::hardware::google::pixel::reportUsbPortOverheat;
|
using android::hardware::google::pixel::reportUsbPortOverheat;
|
||||||
|
using android::String8;
|
||||||
|
using android::Vector;
|
||||||
|
|
||||||
namespace aidl {
|
namespace aidl {
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -79,6 +84,12 @@ constexpr int kSamplingIntervalSec = 5;
|
||||||
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
||||||
std::vector<PortStatus> *currentPortStatus);
|
std::vector<PortStatus> *currentPortStatus);
|
||||||
|
|
||||||
|
#define CTRL_TRANSFER_TIMEOUT_MSEC 1000
|
||||||
|
#define GL852G_VENDOR_ID 0x05e3
|
||||||
|
#define GL852G_PRODUCT_ID1 0x0608
|
||||||
|
#define GL852G_PRODUCT_ID2 0x0610
|
||||||
|
#define GL852G_VENDOR_CMD_REQ 0xe3
|
||||||
|
|
||||||
ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
int64_t in_transactionId) {
|
int64_t in_transactionId) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -683,7 +694,7 @@ Status getPortStatusHelper(android::hardware::usb::Usb *usb,
|
||||||
|
|
||||||
PortRole currentRole;
|
PortRole currentRole;
|
||||||
currentRole.set<PortRole::powerRole>(PortPowerRole::NONE);
|
currentRole.set<PortRole::powerRole>(PortPowerRole::NONE);
|
||||||
if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS){
|
if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS) {
|
||||||
(*currentPortStatus)[i].currentPowerRole = currentRole.get<PortRole::powerRole>();
|
(*currentPortStatus)[i].currentPowerRole = currentRole.get<PortRole::powerRole>();
|
||||||
} else {
|
} else {
|
||||||
ALOGE("Error while retrieving portNames");
|
ALOGE("Error while retrieving portNames");
|
||||||
|
@ -1029,6 +1040,108 @@ ScopedAStatus Usb::setCallback(const shared_ptr<IUsbCallback>& in_callback) {
|
||||||
return ScopedAStatus::ok();
|
return ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct hub_vendor_cmd {
|
||||||
|
// wValue filed of standard device request
|
||||||
|
int value;
|
||||||
|
// wIndex field of standard device request
|
||||||
|
int index;
|
||||||
|
// Output pipe to shell command
|
||||||
|
int out;
|
||||||
|
// Whether the hub is found
|
||||||
|
bool found;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int usbDeviceAdded(const char *devname, void* client_data) {
|
||||||
|
struct hub_vendor_cmd *cmd = (struct hub_vendor_cmd *)client_data;
|
||||||
|
uint16_t vendorId, productId;
|
||||||
|
struct usb_device *device = usb_device_open(devname);
|
||||||
|
|
||||||
|
if (!device) {
|
||||||
|
dprintf(cmd->out, "usb_device_open failed\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The vendor cmd only applies to USB Hubs of Genesys Logic, Inc.
|
||||||
|
// The request field of vendor cmd is fixed to 0xe3.
|
||||||
|
vendorId = usb_device_get_vendor_id(device);
|
||||||
|
productId = usb_device_get_product_id(device);
|
||||||
|
if (vendorId == GL852G_VENDOR_ID &&
|
||||||
|
(productId == GL852G_PRODUCT_ID1 || productId == GL852G_PRODUCT_ID2)) {
|
||||||
|
int ret = usb_device_control_transfer(
|
||||||
|
device, USB_DIR_OUT | USB_TYPE_VENDOR,
|
||||||
|
GL852G_VENDOR_CMD_REQ, cmd->value, cmd->index, NULL, 0,
|
||||||
|
CTRL_TRANSFER_TIMEOUT_MSEC);
|
||||||
|
dprintf(cmd->out, "Vendor cmd %s (wValue %x, wIndex %x, return %d)\n",
|
||||||
|
ret? "failed" : "succeeded", cmd->value, cmd->index, ret);
|
||||||
|
// Stop iterating through usb devices once the hub is found.
|
||||||
|
cmd->found = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int usbDiscoveryDone(void *client_data)
|
||||||
|
{
|
||||||
|
struct hub_vendor_cmd *cmd = (struct hub_vendor_cmd *)client_data;
|
||||||
|
|
||||||
|
dprintf(cmd->out, "Done USB discovery, hub %s found\n",
|
||||||
|
cmd->found ? "is" : "not");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static status_t sendHubVendorCmd(int out, Vector<String8>& args) {
|
||||||
|
if (args.size() < 3) {
|
||||||
|
dprintf(out, "Incorrect number of argument supplied\n");
|
||||||
|
return ::android::UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
struct hub_vendor_cmd cmd = {
|
||||||
|
.value = std::stoi(args[1].c_str(), NULL, 16),
|
||||||
|
.index = std::stoi(args[2].c_str(), NULL, 16),
|
||||||
|
.out = out,
|
||||||
|
.found = false
|
||||||
|
};
|
||||||
|
|
||||||
|
struct usb_host_context *ctx;
|
||||||
|
ctx = usb_host_init();
|
||||||
|
if (!ctx) {
|
||||||
|
dprintf(out, "usb_host_init failed\n");
|
||||||
|
return ::android::UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
usb_host_run(ctx, usbDeviceAdded, NULL, usbDiscoveryDone, &cmd);
|
||||||
|
usb_host_cleanup(ctx);
|
||||||
|
|
||||||
|
return ::android::NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Usb::handleShellCommand(int in, int out, int err, const char** argv,
|
||||||
|
uint32_t argc) {
|
||||||
|
uid_t uid = AIBinder_getCallingUid();
|
||||||
|
if (uid != AID_ROOT && uid != AID_SHELL) {
|
||||||
|
return ::android::PERMISSION_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<String8> utf8Args;
|
||||||
|
utf8Args.setCapacity(argc);
|
||||||
|
for (uint32_t i = 0; i < argc; i++) {
|
||||||
|
utf8Args.push(String8(argv[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc >= 1) {
|
||||||
|
if (!utf8Args[0].compare(String8("hub-vendor-cmd"))) {
|
||||||
|
return sendHubVendorCmd(out, utf8Args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf(out, "usage: adb shell cmd hub-vendor-cmd VALUE INDEX\n"
|
||||||
|
" VALUE wValue field in hex format, e.g. f321\n"
|
||||||
|
" INDEX wIndex field in hex format, e.g. f321\n");
|
||||||
|
|
||||||
|
return ::android::NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace usb
|
} // namespace usb
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
|
@ -43,6 +43,7 @@ using ::android::hardware::google::pixel::usb::ZoneInfo;
|
||||||
using ::android::hardware::thermal::V2_0::TemperatureType;
|
using ::android::hardware::thermal::V2_0::TemperatureType;
|
||||||
using ::android::hardware::thermal::V2_0::ThrottlingSeverity;
|
using ::android::hardware::thermal::V2_0::ThrottlingSeverity;
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
using ::android::status_t;
|
||||||
using ::ndk::ScopedAStatus;
|
using ::ndk::ScopedAStatus;
|
||||||
using ::std::shared_ptr;
|
using ::std::shared_ptr;
|
||||||
using ::std::string;
|
using ::std::string;
|
||||||
|
@ -68,9 +69,12 @@ struct Usb : public BnUsb {
|
||||||
ScopedAStatus enableUsbDataWhileDocked(const string& in_portName,
|
ScopedAStatus enableUsbDataWhileDocked(const string& in_portName,
|
||||||
int64_t in_transactionId) override;
|
int64_t in_transactionId) override;
|
||||||
ScopedAStatus limitPowerTransfer(const string& in_portName, bool in_limit,
|
ScopedAStatus limitPowerTransfer(const string& in_portName, bool in_limit,
|
||||||
int64_t in_transactionId) override;
|
int64_t in_transactionId) override;
|
||||||
ScopedAStatus resetUsbPort(const string& in_portName, int64_t in_transactionId) override;
|
ScopedAStatus resetUsbPort(const string& in_portName, int64_t in_transactionId) override;
|
||||||
|
|
||||||
|
status_t handleShellCommand(int in, int out, int err, const char** argv,
|
||||||
|
uint32_t argc) override;
|
||||||
|
|
||||||
std::shared_ptr<::aidl::android::hardware::usb::IUsbCallback> mCallback;
|
std::shared_ptr<::aidl::android::hardware::usb::IUsbCallback> mCallback;
|
||||||
// Protects mCallback variable
|
// Protects mCallback variable
|
||||||
pthread_mutex_t mLock;
|
pthread_mutex_t mLock;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
service vendor.usb /vendor/bin/hw/android.hardware.usb-service
|
service vendor.usb /vendor/bin/hw/android.hardware.usb-service
|
||||||
class hal
|
class hal
|
||||||
user system
|
user system
|
||||||
group system shell wakelock
|
group system shell wakelock usb
|
||||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
capabilities WAKE_ALARM BLOCK_SUSPEND
|
||||||
|
|
||||||
on post-fs
|
on post-fs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue