tazpanel rev 596
hardware.cgi: read pci.ids
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Aug 04 11:52:15 2016 +0200 (2016-08-04) |
parents | 082ddf66f84b |
children | e5723984d2b0 |
files | hardware.cgi |
line diff
1.1 --- a/hardware.cgi Sun Jul 17 20:32:35 2016 -0400 1.2 +++ b/hardware.cgi Thu Aug 04 11:52:15 2016 +0200 1.3 @@ -79,7 +79,22 @@ 1.4 </tr></thead> 1.5 <tbody> 1.6 EOT 1.7 - lspci | sed 's| |</td><td>|; 1.8 + lspci | while read a b c id ; do 1.9 + echo -n "$a " 1.10 + if [ $b != "Class" ] || [ ! -s /usr/share/misc/pci.ids.gz ]; then 1.11 + echo "$b $c $id" 1.12 + continue 1.13 + fi 1.14 + zcat /usr/share/misc/pci.ids.gz | \ 1.15 + awk -va=${c:0:2} -vb=${c:2:2} -vh=${id:0:4} -vl=${id:5:4} '{ 1.16 + if ($1 == "C" && $2 == a) class=substr($0,5) 1.17 + if (class != "" && $1 == b) { class=substr($0,5); exit } 1.18 + if (substr($0,1,4) == h) m=substr($0,7) 1.19 + else if (m == "") next 1.20 + else if (substr($0,2,4) == l) { name=m substr($0,7); m="" } 1.21 + else if ($1 == h && $2 == l) { name=m substr($0,14); m="" } 1.22 +} END { print class ": " name }' 1.23 + done | sed 's| |</td><td>|; 1.24 s|: |</td><td>|; 1.25 s|^\([^<]*\)|<a href="?lspci=\1">\1</a>|; 1.26 s|^.*$|<tr><td>\0</td></tr>|'