Skip to content

getprop_or_none acts as getprop #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
HorizonEmuTeam opened this issue Dec 15, 2024 · 5 comments
Open

getprop_or_none acts as getprop #50

HorizonEmuTeam opened this issue Dec 15, 2024 · 5 comments

Comments

@HorizonEmuTeam
Copy link

I am getting an error because panel.py couldn't find an optional property. Getprop_or_none() is used, but the program returns getprop()'s error and fails. Expected behaviour is getprop_or_none() ignoring the unfound property and just returning nothing.
Log:
Parsing: dsi-panel-oplus-senna-bc-nt37705-1240-2772-dsc-cmd.dtb
Parsing: oplus_senna_bc_nt37705_1240_2772_dsc_cmd (senna ab575 tm nt37705 dsc cmd mode panel)
WARNING: Multiple display timings are not supported yet, using first!
ERROR: Failed to get property: qcom,mdss-dsi-bl-pmic-control-type
Traceback (most recent call last):
File "/home/user/linux-mdss-dsi-panel-driver-generator/lmdpdg.py", line 77, in
panel = Panel.parse(fdt, offset)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/linux-mdss-dsi-panel-driver-generator/panel.py", line 334, in parse
return name and Panel(name.as_str(), fdt, node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/linux-mdss-dsi-panel-driver-generator/panel.py", line 233, in init
backlight = fdt.getprop_or_none(node, 'qcom,mdss-dsi-bl-pmic-control-type')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/linux-mdss-dsi-panel-driver-generator/fdt2.py", line 38, in getprop_or_none
prop = self.getprop(nodeoffset, prop_name, [FDT_ERR_NOTFOUND])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/linux-mdss-dsi-panel-driver-generator/fdt2.py", line 32, in getprop
return super().getprop(nodeoffset, prop_name, quiet)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.12/site-packages/libfdt.py", line 454, in getprop
return Property(prop_name, bytearray(pdata[0]))
^^^^^^^^^^^^^^^^^^^
TypeError: cannot convert 'NoneType' object to bytearray
dsi-panel-oplus-senna-bc-nt37705-1240-2772-dsc-cmd.dtb does not contain any usable panel specifications

@HorizonEmuTeam
Copy link
Author

HorizonEmuTeam commented Dec 15, 2024

I am using Python 3.12.3 (main, Nov 6 2024, 18:32:19) and latest current release of linux-mdss-dsi-panel-driver-generator, also pylibfdt from dtc 1.7.2.

@stephan-gh
Copy link
Member

This feels related to https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5, can you try if latest pylibfdt (from main branch) fixes it?

@MarvelMathesh
Copy link

Parsing: dsi-panel-tianma-td4310-1080p-video.dtb
Parsing: td4310_tianma_fhd_video (tianma td4310 fhd video mode dsi panel)
ERROR: Failed to get property: qcom,mdss-dsi-lane-4-state
Traceback (most recent call last):
File "/home/mathesh/Documents/whyred/linux-mdss-dsi-panel-driver-generator/./lmdpdg.py", line 77, in <module>
panel = Panel.parse(fdt, offset)
File "/home/mathesh/Documents/whyred/linux-mdss-dsi-panel-driver-generator/panel.py", line 335, in parse
return name and Panel(name.as_str(), fdt, node)
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mathesh/Documents/whyred/linux-mdss-dsi-panel-driver-generator/panel.py", line 242, in __init__
while fdt.getprop_or_none(node, f'qcom,mdss-dsi-lane-{self.lanes}-state') is not None:
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mathesh/Documents/whyred/linux-mdss-dsi-panel-driver-generator/fdt2.py", line 38, in getprop_or_none
prop = self.getprop(nodeoffset, prop_name, [FDT_ERR_NOTFOUND])
File "/home/mathesh/Documents/whyred/linux-mdss-dsi-panel-driver-generator/fdt2.py", line 32, in getprop
return super().getprop(nodeoffset, prop_name, quiet)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mathesh/.local/lib/python3.13/site-packages/libfdt.py", line 454, in getprop
return Property(prop_name, bytearray(pdata[0]))
~~~~~~~~~^^^^^^^^^^
TypeError: cannot convert 'NoneType' object to bytearray
dsi-panel-tianma-td4310-1080p-video.dtb does not contain any usable panel specifications
/dts-v1/;

/ {
    mdp {
        compatible = "qcom,mdss_mdp";

        /* Add your panels here */
        dsi_td4310_tianma_fhd_video: qcom,mdss_dsi_td4310_tianma_fhd_video {
            qcom,mdss-dsi-panel-name = "tianma td4310 fhd video mode dsi panel";
			/* qcom,mdss-dsi-panel-controller = <&mdss_dsi0>; */
            qcom,mdss-dsi-panel-type = "dsi_video_mode";
            qcom,mdss-dsi-panel-framerate = <60>;
            qcom,mdss-dsi-virtual-channel-id = <0>;
            qcom,mdss-dsi-stream = <0>;
            qcom,mdss-dsi-panel-width = <1080>;
            qcom,mdss-dsi-panel-height = <2160>;
            qcom,mdss-pan-physical-width-dimension = <68>;
            qcom,mdss-pan-physical-height-dimension = <136>;
            qcom,mdss-dsi-h-front-porch = <108>;
            qcom,mdss-dsi-h-back-porch = <60>;
            qcom,mdss-dsi-h-pulse-width = <12>;
            qcom,mdss-dsi-h-sync-skew = <0>;
            qcom,mdss-dsi-v-back-porch = <33>;
            qcom,mdss-dsi-v-front-porch = <6>;
            qcom,mdss-dsi-v-pulse-width = <4>;
            qcom,mdss-dsi-h-left-border = <0>;
            qcom,mdss-dsi-h-right-border = <0>;
            qcom,mdss-dsi-v-top-border = <0>;
            qcom,mdss-dsi-v-bottom-border = <0>;
            qcom,mdss-dsi-bpp = <24>;
            qcom,mdss-dsi-underflow-color = <0xff>;
            qcom,mdss-dsi-border-color = <0>;
            qcom,mdss-dsi-h-sync-pulse = <0>;
            qcom,mdss-dsi-traffic-mode = "burst_mode";
            qcom,mdss-dsi-bllp-eof-power-mode;
            qcom,mdss-dsi-bllp-power-mode;
            qcom,mdss-dsi-lane-0-state;
            qcom,mdss-dsi-lane-1-state;
            qcom,mdss-dsi-lane-2-state;
            qcom,mdss-dsi-lane-3-state;
            qcom,mdss-dsi-panel-timings = [e6 38 26 00 68 6e 2a 3c 44 03 04 00];
            qcom,mdss-dsi-t-clk-post = <0x0e>;
            qcom,mdss-dsi-t-clk-pre = <0x35>;
            qcom,mdss-dsi-bl-min-level = <1>;
            qcom,mdss-dsi-bl-max-level = <4095>;
            qcom,mdss-dsi-dma-trigger = "trigger_sw";
            qcom,mdss-dsi-mdp-trigger = "none";
            qcom,mdss-dsi-on-command = [
                39 01 00 00 46 00 02 11 00
                29 01 00 00 00 00 02 B0 04
                29 01 00 00 00 00 02 D6 01
                29 01 00 00 00 00 02 ea 0a
                39 01 00 00 00 00 02 51 ff
                39 01 00 00 00 00 02 53 2c
                29 01 00 00 00 00 1A CE 55 40 56 6E 87 95 a0 b0 c0 c2 c9 ce df e3 e4 ec FF 04 00 00 04 46 04 69 5A
                39 01 00 00 00 00 02 55 00
                39 01 00 00 00 00 02 35 00
                39 01 00 00 14 00 02 29 00
            ];
            qcom,mdss-dsi-off-command = [
                05 01 00 00 14 00 02 28 00
                05 01 00 00 78 00 02 10 00
            ];
            qcom,mdss-dsi-on-command-state = "dsi_lp_mode";
            qcom,mdss-dsi-off-command-state = "dsi_hs_mode";
            qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_wled";
            qcom,mdss-dsi-reset-sequence = <1 1>, <0 5>, <1 35>;
            qcom,mdss-dsi-tx-eot-append;
            qcom,mdss-dsi-post-init-delay = <1>;
            qcom,ulps-enabled;
            qcom,panel-allow-phy-poweroff;
            qcom,mdss-dsi-panel-status-command = [06 01 00 01 05 00 01 0A];
            qcom,mdss-dsi-panel-status-command-state = "dsi_hs_mode";
            qcom,mdss-dsi-panel-status-check-mode = "reg_read";
            qcom,mdss-dsi-panel-status-read-length = <1>;
            qcom,mdss-dsi-panel-status-value = <0x1c>;
            qcom,mdss-dsi-panel-max-error-count = <3>;
        };
    };
};

I'm encountering the same issue even with the latest DTC, are there any workarounds?

@strongtz
Copy link

the latest DTC does solve the problem for me

@myryk31415
Copy link

myryk31415 commented Feb 26, 2025

I installed pylibfdt and libfdt from the dtc main / master branches but both times it says
ImportError: .../.venv/lib64/python3.11/site-packages/libfdt-1.7.2-py3.11-linux-x86_64.egg/_libfdt.cpython-311-x86_64-linux-gnu.so: undefined symbol: fdt_setprop_placeholder_namelen while trying to import _libfdt

Maybe it didn't install libfdt correctly, I'll try again to see if the log gives more information

Edit: Cherry-picking only the specific commit onto the 1.7.2 branch worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants