Skip to content

Auto-detect device from device tree#422

Open
WhyNotHugo wants to merge 1 commit into
baskerville:masterfrom
WhyNotHugo:product-form-device-tree
Open

Auto-detect device from device tree#422
WhyNotHugo wants to merge 1 commit into
baskerville:masterfrom
WhyNotHugo:product-form-device-tree

Conversation

@WhyNotHugo

Copy link
Copy Markdown

Attempt to auto-detect the device by reading the device tree compatibility from the kernel. If this information is unavailable or the values are unknown, gracefully fall back to the current approach (using environment variables).

I've only included the Clara HD for now: I don't have access to other devices in order to figure out which values they return, but I've left a clear place where they can be added progressively by others.

Attempt to auto-detect the device by reading the device tree
compatibility from the kernel. If this information is unavailable or the
values are unknown, gracefully fall back to the current approach (using
environment variables).

I've only included the Clara HD for now: I don't have access to other
devices in order to figure out which values they return, but I've left a
clear place where they can be added progressively by others.
@fabricionaweb

Copy link
Copy Markdown

I have a kobo libra colour, how can I help?

[root@kobo ~]# cat /proc/device-tree/compatible
mediatek,mt8110mediatek,mt8512
[root@kobo ~]# cat /sys/firmware/devicetree/base/compatible
mediatek,mt8110mediatek,mt8512

@WhyNotHugo

Copy link
Copy Markdown
Author

cat /proc/device-tree/compatible | tr '\0' '\n' should replace null bytes with newlines, but I suspect the output would look like:

mediatek,mt8110
mediatek,mt8512

That's a bit of a generic description for the device. I wonder if mapping that to LibraColour is safe or if we'll get false positive with other devices.

@OGKevin

OGKevin commented Jun 4, 2026

Copy link
Copy Markdown

I guess there is only really 1 way to find out, and just keep crowd sourcing the values.

Can also add code to log it at start up, if it's an unknown value, and have docs for interested users to report the value. Or they can unconsciously report it when sharing logs for an unrelated bug report.

Since some early boot process is setting these values for Nickel, there might be way to reverse engineer how the env variable is set, and that might confirm if these are unique or not. Or what is actually used to populate these env vars.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants