Snap for 11908474 from e252dc733c
to 24Q3-release
Change-Id: I2157442a6c57821f49b1d81b304e4ac3f813cb27
This commit is contained in:
commit
bf3e75deae
9 changed files with 138 additions and 8 deletions
2
OWNERS
2
OWNERS
|
@ -1,2 +1,2 @@
|
|||
# per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details.
|
||||
per-file *.mk=file:device/google/gs-common:main:/OWNERS
|
||||
per-file *.mk=file:device/google/gs-common:main:/MK_OWNERS
|
||||
|
|
|
@ -86,6 +86,8 @@
|
|||
<permission name="android.permission.ACTIVITY_RECOGNITION" fixed="false"/>
|
||||
<!-- Used to display notifications for Spectrum Speedboost and Satellite eSOS -->
|
||||
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||
<!-- Used by Bluetooth Module to collect bluetooth info -->
|
||||
<permission name="android.permission.BLUETOOTH_CONNECT" fixed="false"/>
|
||||
</exception>
|
||||
|
||||
<exception
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
<Limit name="measured-frame-rate-352x288" range="233-315" />
|
||||
<Limit name="measured-frame-rate-640x360" range="114-247" />
|
||||
<Limit name="measured-frame-rate-720x480" range="47-189" />
|
||||
<Limit name="measured-frame-rate-1280x720" range="44-54" />
|
||||
<Limit name="measured-frame-rate-1280x720" range="86-185" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.android.av1-dav1d.decoder" type="video/av01" update="true">
|
||||
<Limit name="measured-frame-rate-352x288" range="689-881" />
|
||||
|
|
|
@ -137,7 +137,10 @@ const struct UeventListener::UeventPaths ueventPaths = {
|
|||
.AudioUevent = "/devices/virtual/amcs/amcs",
|
||||
.TypeCPartnerUevent = "PRODUCT_TYPE=",
|
||||
.FwUpdatePath = "/sys/devices/platform/maxim,max77779fwu/update_stats",
|
||||
.FGAbnlPath = "/sys/class/power_supply/max77779fg/fg_abnormal_events"
|
||||
.FGAbnlPath = {
|
||||
"/dev/logbuffer_max77779fg_monitor",
|
||||
"/dev/logbuffer_maxfg_base_monitor",
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -40,6 +40,7 @@ cc_binary {
|
|||
"libbinder",
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libusbhost",
|
||||
"libutils",
|
||||
"libhardware",
|
||||
"android.hardware.thermal@1.0",
|
||||
|
|
120
usb/usb/Usb.cpp
120
usb/usb/Usb.cpp
|
@ -23,10 +23,12 @@
|
|||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <usbhost/usbhost.h>
|
||||
#include <regex>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
|
@ -37,6 +39,7 @@
|
|||
#include <sys/timerfd.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include "Usb.h"
|
||||
|
||||
|
@ -58,6 +61,8 @@ using android::hardware::google::pixel::getStatsService;
|
|||
using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat;
|
||||
using android::hardware::google::pixel::reportUsbPortOverheat;
|
||||
using android::hardware::google::pixel::usb::getI2cClientPath;
|
||||
using android::String8;
|
||||
using android::Vector;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
|
@ -116,6 +121,15 @@ void queryVersionHelper(android::hardware::usb::Usb *usb,
|
|||
AltModeData::DisplayPortAltModeData constructAltModeData(string hpd, string pin_assignment,
|
||||
string link_status, string vdo);
|
||||
|
||||
#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
|
||||
// GL852G port 1 and port 2 JK level default settings
|
||||
#define GL852G_VENDOR_CMD_VALUE_DEFAULT 0x0008
|
||||
#define GL852G_VENDOR_CMD_INDEX_DEFAULT 0x0404
|
||||
|
||||
ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||
int64_t in_transactionId) {
|
||||
bool result = true;
|
||||
|
@ -510,6 +524,61 @@ void updatePortStatus(android::hardware::usb::Usb *usb) {
|
|||
queryVersionHelper(usb, ¤tPortStatus);
|
||||
}
|
||||
|
||||
static int usbDeviceRemoved(const char *devname, void* client_data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbDeviceAdded(const char *devname, void* client_data) {
|
||||
uint16_t vendorId, productId;
|
||||
struct usb_device *device;
|
||||
::aidl::android::hardware::usb::Usb *usb;
|
||||
int value, index;
|
||||
|
||||
device = usb_device_open(devname);
|
||||
if (!device) {
|
||||
ALOGE("usb_device_open failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
usb = (::aidl::android::hardware::usb::Usb *)client_data;
|
||||
value = usb->mUsbHubVendorCmdValue;
|
||||
index = usb->mUsbHubVendorCmdIndex;
|
||||
|
||||
// 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, value, index,
|
||||
NULL, 0, CTRL_TRANSFER_TIMEOUT_MSEC);
|
||||
ALOGI("USB hub vendor cmd %s (wValue 0x%x, wIndex 0x%x, return %d)\n",
|
||||
ret? "failed" : "succeeded", value, index, ret);
|
||||
}
|
||||
|
||||
usb_device_close(device);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *usbHostWork(void *param) {
|
||||
struct usb_host_context *ctx;
|
||||
|
||||
ALOGI("creating USB host thread\n");
|
||||
|
||||
ctx = usb_host_init();
|
||||
if (!ctx) {
|
||||
ALOGE("usb_host_init failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// This will never return, it will keep monitoring USB sysfs inotify events
|
||||
usb_host_run(ctx, usbDeviceAdded, usbDeviceRemoved, NULL, param);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Usb::Usb()
|
||||
: mLock(PTHREAD_MUTEX_INITIALIZER),
|
||||
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
|
||||
|
@ -531,7 +600,9 @@ Usb::Usb()
|
|||
mDisplayPortPollRunning(false),
|
||||
mDisplayPortPollStarting(false),
|
||||
mDisplayPortCVLock(PTHREAD_MUTEX_INITIALIZER),
|
||||
mDisplayPortLock(PTHREAD_MUTEX_INITIALIZER) {
|
||||
mDisplayPortLock(PTHREAD_MUTEX_INITIALIZER),
|
||||
mUsbHubVendorCmdValue(GL852G_VENDOR_CMD_VALUE_DEFAULT),
|
||||
mUsbHubVendorCmdIndex(GL852G_VENDOR_CMD_INDEX_DEFAULT) {
|
||||
pthread_condattr_t attr;
|
||||
if (pthread_condattr_init(&attr)) {
|
||||
ALOGE("pthread_condattr_init failed: %s", strerror(errno));
|
||||
|
@ -568,6 +639,10 @@ Usb::Usb()
|
|||
ALOGE("mDisplayPortActivateTimer timerfd failed: %s", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
if (pthread_create(&mUsbHost, NULL, usbHostWork, this)) {
|
||||
ALOGE("pthread creation failed %d\n", errno);
|
||||
abort();
|
||||
}
|
||||
|
||||
ALOGI("feature flag enable_usb_data_compliance_warning: %d",
|
||||
usb_flags::enable_usb_data_compliance_warning());
|
||||
|
@ -853,7 +928,7 @@ Status getPortStatusHelper(android::hardware::usb::Usb *usb,
|
|||
|
||||
PortRole currentRole;
|
||||
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>();
|
||||
} else {
|
||||
ALOGE("Error while retrieving portNames");
|
||||
|
@ -1939,6 +2014,47 @@ void Usb::shutdownDisplayPortPoll(bool force) {
|
|||
}
|
||||
}
|
||||
|
||||
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"))) {
|
||||
if (utf8Args.size() < 3) {
|
||||
dprintf(out, "Incorrect number of argument supplied\n");
|
||||
return ::android::UNKNOWN_ERROR;
|
||||
}
|
||||
int value, index;
|
||||
if (!::android::base::ParseInt(utf8Args[1].c_str(), &value) ||
|
||||
!::android::base::ParseInt(utf8Args[2].c_str(), &index)) {
|
||||
dprintf(out, "Fail to parse arguments\n");
|
||||
return ::android::UNKNOWN_ERROR;
|
||||
}
|
||||
mUsbHubVendorCmdValue = value;
|
||||
mUsbHubVendorCmdIndex = index;
|
||||
ALOGI("USB hub vendor cmd update (wValue 0x%x, wIndex 0x%x)\n",
|
||||
mUsbHubVendorCmdValue, mUsbHubVendorCmdIndex);
|
||||
return ::android::NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
dprintf(out, "usage: adb shell cmd hub-vendor-cmd VALUE INDEX\n"
|
||||
" VALUE wValue field in hex format, e.g. 0xf321\n"
|
||||
" INDEX wIndex field in hex format, e.g. 0xf321\n"
|
||||
" The settings take effect next time the hub is enabled\n");
|
||||
|
||||
return ::android::NO_ERROR;
|
||||
}
|
||||
|
||||
} // namespace usb
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
|
|
@ -55,6 +55,7 @@ using ::android::hardware::google::pixel::usb::ZoneInfo;
|
|||
using ::android::hardware::thermal::V2_0::TemperatureType;
|
||||
using ::android::hardware::thermal::V2_0::ThrottlingSeverity;
|
||||
using ::android::sp;
|
||||
using ::android::status_t;
|
||||
using ::ndk::ScopedAStatus;
|
||||
using ::std::shared_ptr;
|
||||
using ::std::string;
|
||||
|
@ -97,7 +98,7 @@ struct Usb : public BnUsb {
|
|||
ScopedAStatus enableUsbDataWhileDocked(const string& in_portName,
|
||||
int64_t in_transactionId) override;
|
||||
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;
|
||||
|
||||
Status getDisplayPortUsbPathHelper(string *path);
|
||||
|
@ -108,6 +109,8 @@ struct Usb : public BnUsb {
|
|||
void setupDisplayPortPoll();
|
||||
void shutdownDisplayPortPollHelper();
|
||||
void shutdownDisplayPortPoll(bool force);
|
||||
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;
|
||||
// Protects mCallback variable
|
||||
|
@ -164,10 +167,15 @@ struct Usb : public BnUsb {
|
|||
*/
|
||||
bool mPartnerSupportsDisplayPort;
|
||||
|
||||
// Usb hub vendor command settings for JK level tuning
|
||||
int mUsbHubVendorCmdValue;
|
||||
int mUsbHubVendorCmdIndex;
|
||||
|
||||
private:
|
||||
pthread_t mPoll;
|
||||
pthread_t mDisplayPortPoll;
|
||||
pthread_t mDisplayPortShutdownHelper;
|
||||
pthread_t mUsbHost;
|
||||
};
|
||||
|
||||
} // namespace usb
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
service vendor.usb /vendor/bin/hw/android.hardware.usb-service
|
||||
class hal
|
||||
user system
|
||||
group system shell wakelock
|
||||
group system shell wakelock usb
|
||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
||||
|
||||
on post-fs
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
service vendor.usb /vendor/bin/hw/android.hardware.usb-service
|
||||
class hal
|
||||
user system
|
||||
group system shell wakelock
|
||||
group system shell wakelock usb
|
||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
||||
|
||||
on post-fs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue