Add hpd and link training status to usb frameworks
Adds hpd and linkTrainingStatus fields to DisplayPortAltModeInfo. Changes dumpsys simulation to update new fields, and defines expected types for all DisplayPortAltModeInfo fields. Test: manually check field population using simulator Bug: 253534975 Change-Id: Icd49fb468bbc186ae44f9b8169cb8045997390c0
This commit is contained in:
@@ -39,6 +39,8 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
private final @DisplayPortAltModeStatus int mPartnerSinkStatus;
|
||||
private final @DisplayPortAltModeStatus int mCableStatus;
|
||||
private final int mNumLanes;
|
||||
private final boolean mHpd;
|
||||
private final int mLinkTrainingStatus;
|
||||
|
||||
/**
|
||||
* Port Partners:
|
||||
@@ -103,14 +105,18 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
mPartnerSinkStatus = DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
mCableStatus = DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
mNumLanes = 0;
|
||||
mHpd = false;
|
||||
mLinkTrainingStatus = 0;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public DisplayPortAltModeInfo(int partnerSinkStatus, int cableStatus,
|
||||
int numLanes) {
|
||||
int numLanes, boolean hpd, int linkTrainingStatus) {
|
||||
mPartnerSinkStatus = partnerSinkStatus;
|
||||
mCableStatus = cableStatus;
|
||||
mNumLanes = numLanes;
|
||||
mHpd = hpd;
|
||||
mLinkTrainingStatus = linkTrainingStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,6 +161,8 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
dest.writeInt(mPartnerSinkStatus);
|
||||
dest.writeInt(mCableStatus);
|
||||
dest.writeInt(mNumLanes);
|
||||
dest.writeBoolean(mHpd);
|
||||
dest.writeInt(mLinkTrainingStatus);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -166,6 +174,10 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
+ mCableStatus
|
||||
+ " numLanes="
|
||||
+ mNumLanes
|
||||
+ " hpd="
|
||||
+ mHpd
|
||||
+ " linkTrainingStatus="
|
||||
+ mLinkTrainingStatus
|
||||
+ "}";
|
||||
}
|
||||
|
||||
@@ -195,7 +207,10 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
int partnerSinkStatus = in.readInt();
|
||||
int cableStatus = in.readInt();
|
||||
int numLanes = in.readInt();
|
||||
return new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes);
|
||||
boolean hpd = in.readBoolean();
|
||||
int linkTrainingStatus = in.readInt();
|
||||
return new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes, hpd,
|
||||
linkTrainingStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -866,7 +866,8 @@ public class UsbPortManager implements IBinder.DeathRecipient {
|
||||
|
||||
|
||||
public void simulateDisplayPortAltModeInfo(String portId, int partnerSinkStatus,
|
||||
int cableStatus, int numLanes, IndentingPrintWriter pw) {
|
||||
int cableStatus, int numLanes, boolean hpd, int linkTrainingStatus,
|
||||
IndentingPrintWriter pw) {
|
||||
synchronized (mLock) {
|
||||
final RawPortInfo portInfo = mSimulatedPorts.get(portId);
|
||||
if (portInfo == null) {
|
||||
@@ -875,7 +876,8 @@ public class UsbPortManager implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
DisplayPortAltModeInfo displayPortAltModeInfo =
|
||||
new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes);
|
||||
new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes, hpd,
|
||||
linkTrainingStatus);
|
||||
portInfo.displayPortAltModeInfo = displayPortAltModeInfo;
|
||||
pw.println("Simulating DisplayPort Info: " + displayPortAltModeInfo);
|
||||
updatePortsLocked(pw, null);
|
||||
|
||||
@@ -1169,14 +1169,17 @@ public class UsbService extends IUsbManager.Stub {
|
||||
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
|
||||
"", 0);
|
||||
}
|
||||
} else if ("set-displayport-status".equals(args[0]) && args.length == 5) {
|
||||
} else if ("set-displayport-status".equals(args[0]) && args.length == 7) {
|
||||
final String portId = args[1];
|
||||
final int partnerSinkStatus = Integer.parseInt(args[2]);
|
||||
final int cableStatus = Integer.parseInt(args[3]);
|
||||
final int displayPortNumLanes = Integer.parseInt(args[4]);
|
||||
final boolean hpd = Boolean.parseBoolean(args[5]);
|
||||
final int linkTrainingStatus = Integer.parseInt(args[6]);
|
||||
if (mPortManager != null) {
|
||||
mPortManager.simulateDisplayPortAltModeInfo(portId,
|
||||
partnerSinkStatus, cableStatus, displayPortNumLanes, pw);
|
||||
partnerSinkStatus, cableStatus, displayPortNumLanes,
|
||||
hpd, linkTrainingStatus, pw);
|
||||
pw.println();
|
||||
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
|
||||
"", 0);
|
||||
@@ -1187,7 +1190,10 @@ public class UsbService extends IUsbManager.Stub {
|
||||
mPortManager.simulateDisplayPortAltModeInfo(portId,
|
||||
DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
0, pw);
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
pw);
|
||||
pw.println();
|
||||
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
|
||||
"", 0);
|
||||
@@ -1259,7 +1265,13 @@ public class UsbService extends IUsbManager.Stub {
|
||||
pw.println("Example simulate DisplayPort Alt Mode Changes:");
|
||||
pw.println(" dumpsys usb add-port \"matrix\" dual --displayport");
|
||||
pw.println(" dumpsys usb set-displayport-status \"matrix\" <partner-sink>"
|
||||
+ " <cable> <num-lanes>");
|
||||
+ " <cable> <num-lanes> <hpd> <link-training-status>");
|
||||
pw.println("The required fields are as followed:");
|
||||
pw.println(" <partner-sink>: type DisplayPortAltModeStatus");
|
||||
pw.println(" <cable>: type DisplayPortAltModeStatus");
|
||||
pw.println(" <num-lanes>: type int, expected 0, 2, or 4");
|
||||
pw.println(" <hpd>: type boolean, expected true or false");
|
||||
pw.println(" <link-training-status>: type int with range [0,2]");
|
||||
pw.println(" dumpsys usb reset-displayport-status \"matrix\"");
|
||||
pw.println("reset-displayport-status can also be used in order to set");
|
||||
pw.println("the DisplayPortInfo to default values.");
|
||||
|
||||
@@ -639,7 +639,9 @@ public final class UsbPortAidl implements UsbPortHal {
|
||||
altModeData.getDisplayPortAltModeData();
|
||||
return new DisplayPortAltModeInfo(displayPortData.partnerSinkStatus,
|
||||
displayPortData.cableStatus,
|
||||
toDisplayPortAltModeNumLanesInt(displayPortData.pinAssignment));
|
||||
toDisplayPortAltModeNumLanesInt(displayPortData.pinAssignment),
|
||||
displayPortData.hpd,
|
||||
displayPortData.linkTrainingStatus);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user