rockchip: refactor handling of hdmi output mode

Signed-off-by: hmz007 <hmz007@gmail.com>
This commit is contained in:
hmz007
2025-03-19 15:18:22 +08:00
parent 01d53c55c9
commit 7c287c2cb2
2 changed files with 17 additions and 16 deletions
@@ -142,19 +142,20 @@ public class RkDisplayModes {
}
private String readColorFormatFromNode(){
FileReader fr=null;
BufferedReader br=null;
String line="";
FileReader fr = null;
BufferedReader br = null;
String line = "";
String mode = null;
try {
fr = new FileReader(HDMI_DBG_STATUS);
} catch (FileNotFoundException e) {
Log.e(TAG, "Couldn't find or open file "+HDMI_DBG_STATUS, e);
return null;
Log.e(TAG, "Failed to open file: " + e.getMessage());
return mode;
}
br=new BufferedReader(fr);
br = new BufferedReader(fr);
try {
while ((line=br.readLine())!=null) {
while ((line = br.readLine()) != null) {
if (line.contains("Color Format:")) {
StringBuilder builder = new StringBuilder();
int start = line.indexOf("Format:");
@@ -171,17 +172,17 @@ public class RkDisplayModes {
builder.append(STR_YCBCR420).append("-").append(depth).append("bit");
else
builder.append(format).append("-").append(depth).append("bit");
Log.e(TAG, "readColorFormatFromNode :" + builder.toString());
return builder.toString();
mode = builder.toString();
Log.e(TAG, "readColorFormatFromNode :" + mode);
break;
}
}
br.close();
fr.close();
return null;
} catch (IOException e) {
Log.e(TAG, "Couldn't read data from /d/dw-hdmi/status", e);
return null;
Log.e(TAG, "Couldn't read data from " + HDMI_DBG_STATUS, e);
}
return mode;
}
private static boolean readModeWhiteList(String pathname) {
@@ -744,10 +745,9 @@ public class RkDisplayModes {
if (mColorMode != null)
mCurColorMode = mColorMode;
if (mCurColorMode == null)
mCurColorMode = "RGB-8bit";
if (mCurColorMode.equals("")) {
mCurColorMode = "RGB-8bit";
else if (mCurColorMode.equals(""))
mCurColorMode = "Auto";
}
Log.d(TAG, "getCurColorMode =========== " + mCurColorMode);
return mCurColorMode;
}