[LEDE-DEV] [RFC v3 2/2] x86: use sysfs DMI information to populate sysinfo

Karl Palsson karlp at tweak.net.au
Thu Jun 2 03:08:31 PDT 2016


Dirk Neukirchen <dirkneukirchen at web.de> wrote:
> On 01.06.2016 17:14, Jo-Philipp Wich wrote:
> > Use the DMI data available in sysfs to extract manufacturer and model info
> > and write it to /tmp/sysinfo/.
> > 
> > The data will be picked up by board_detect and can be used by e.g. LuCI to
> > display a more appropriate model description.
> > 
> > On an APU board the files will contain the following values:
> > 
> >     # cat /tmp/sysinfo/model
> >     PC Engines APU
> > 
> >     # cat /tmp/sysinfo/board_name
> >     pc-engines-apu
> > 
> > Signed-off-by: Jo-Philipp Wich <jo at mein.io>
> > ---
> >  target/linux/x86/base-files/lib/preinit/20_sysinfo | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >  create mode 100644 target/linux/x86/base-files/lib/preinit/20_sysinfo
> > 
> > diff --git a/target/linux/x86/base-files/lib/preinit/20_sysinfo b/target/linux/x86/base-files/lib/preinit/20_sysinfo
> > new file mode 100644
> > index 0000000..0b836ce
> > --- /dev/null
> > +++ b/target/linux/x86/base-files/lib/preinit/20_sysinfo
> > @@ -0,0 +1,16 @@
> > +do_sysinfo_x86() {
> > +	local vendor product boardname
> > +
> > +	vendor="$(cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null)"
> > +	product="$(cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null)"
> > +
> > +	[ -n "$vendor" -a -n "$product" ] || return
> > +
> > +	boardname="$(printf "%s %s" "$vendor" "$product" | tr 'A-Z' 'a-z' | tr -cs 'a-z0-9_-' '-')"
> > +
> > +	mkdir -p /tmp/sysinfo
> > +	echo "$boardname" > /tmp/sysinfo/board_name
> > +	echo "$vendor $product" > /tmp/sysinfo/model
> 
> Issue 1:
> Maybe change up variable naming to keep more in line with
> sysfs/DMI standards ? as future reference: [1]
> 
> on my normal(?) Intel ATX motherboard both sysfs entries are
> empty but board_name & board_vendor exist: I might expect to
> get /tmp/sysinfo/board_name from board_* and not from the sys_*
> or product* domain
> 
> cat /sys/devices/virtual/dmi/id/board_vendor 
> Intel Corporation
> cat /sys/devices/virtual/dmi/id/board_name 
> DZ77RE-75K
> 

fwiw, my hp laptop (and a colleagues other, newer HP) has both
sys_vendor and product_name (and they're sane...)
sys_vendor:Hewlett-Packard (board_vendor also exists, and is the
same as sys_vendor) product_name:HP EliteBook 8470p

It also has board_name, but it's "useless" 
board_name:179B

I generally like the patch though, it seems like a clear
improvement, even if there turn out to be edge cases.

Cheers,
Karl P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20160602/48bd5929/attachment.sig>


More information about the Lede-dev mailing list