Skip to content
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

od: Simplify model query in scripts #97

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

glebm
Copy link

@glebm glebm commented Nov 22, 2022

/sys/firmware/devicetree/base/compatible is \0-delimited.

Instead of relying on \0-removal and stripping the ingenic.* suffix, simply read the string up to the first \0.

/sys/firmware/devicetree/base/compatible is a \0-delimited file.

Instead of relying on \0-removal and stripping the `ingenic.*` suffix,
simply read the string up to the first \0.

Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
@glebm glebm mentioned this pull request Nov 22, 2022
@pcercuei
Copy link
Member

This is actually much better, because you are using a built-in command instead of an external program.
Just for curiosity, what does IFS= do?

@glebm
Copy link
Author

glebm commented Nov 22, 2022

It unsets the default field separator, which means that whitespace will be preserved, e.g.:
" ylm,rg99 \0 ingenic,jz4725b \0" => " ylm,rg99 " instead of "ylm,rg99"
This should never happen but is always a good practice when calling read -d

@pcercuei pcercuei merged commit 9562d2c into OpenDingux:opendingux Nov 22, 2022
@glebm glebm deleted the read-model branch November 22, 2022 15:19
glebm added a commit to glebm/od-buildroot that referenced this pull request Dec 11, 2023
`/sys/firmware/devicetree/base/compatible` is `\0`-delimited.

Instead of relying on `\0`-removal and stripping the `ingenic.*` suffix, simply read the string up to the first `\0`.

Follow-up to OpenDingux#97 which did this for other script.

Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
pcercuei pushed a commit that referenced this pull request Mar 11, 2024
`/sys/firmware/devicetree/base/compatible` is `\0`-delimited.

Instead of relying on `\0`-removal and stripping the `ingenic.*` suffix, simply read the string up to the first `\0`.

Follow-up to #97 which did this for other script.

Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
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.

2 participants