Closed emersion closed 5 years ago
Is there a way to unify the regular output and the JSON output?
Maybe we could just make the regular output a consumer of the JSON output? It's slightly wasteful creating JSON structures to then not print JSON, but that's hardly a big deal and it already provides the tree for us.
Should we decode blobs?
Yeah, probably. It could just be some freeform "data" field of each property that needs it. Otherwise we'd need to include the raw data (as base64 or similar I guess), and parsing some of the fields is already weird enough (IN_FORMATS) and would make it more difficult to do anything useful with jq and that data.
LGTM so far.
Maybe we could just make the regular output a consumer of the JSON output? It's slightly wasteful creating JSON structures to then not print JSON, but that's hardly a big deal and it already provides the tree for us.
Yeah, that might be a good idea.
Yeah, probably. It could just be some freeform "data" field of each property that needs it. Otherwise we'd need to include the raw data (as base64 or similar I guess), and parsing some of the fields is already weird enough (IN_FORMATS) and would make it more difficult to do anything useful with jq and that data.
I wonder "how much" we should decode. Some things like properties flags (which include the type) and format fourcc codes are hard to consume with jq.
All right, the JSON side is mostly finished. I've decided to duplicate data when relevant, for instance each property has the raw flags
but also some more convenient type
, immutable
and atomic
fields.
I'll begin working on wiring up the pretty-printer.
BTW, I think both encoding the blobs in base64 and exposing a easy-to-use structure might be a good idea. This gives more freedom to consumers and allows them to parse blobs we don't support, such as the EDID.
All right, this is ready for review!
Makes sense, fixed
Thanks
Seeking feedback.
Fixes https://github.com/ascent12/drm_info/issues/4