tazpanel rev 473
hardware.cgi: busybox lsusb support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 30 18:37:05 2015 +0200 (2015-04-30) |
parents | 836e45b5567b |
children | 84d34ba7dc06 |
files | hardware.cgi po/fr.po tazpanel |
line diff
1.1 --- a/hardware.cgi Thu Apr 30 02:25:59 2015 +0300 1.2 +++ b/hardware.cgi Thu Apr 30 18:37:05 2015 +0200 1.3 @@ -27,6 +27,25 @@ 1.4 done 2> /dev/null | sed 's/ */ /g' 1.5 } 1.6 1.7 +lsusb_vd() { 1.8 + if lsusb --help 2>&1 | grep -qi busybox ; then 1.9 + for i in /sys/class/usb_device/*/device ; do 1.10 + grep -qs ${1%:*} $i/idVendor || continue 1.11 + grep -qs ${1#*:} $i/idProduct || continue 1.12 + ( cd $i ; for j in * ; do 1.13 + [ -f $j -a -r $j ] || continue 1.14 + case "$j" in 1.15 + descriptors|remove) continue 1.16 + esac 1.17 + printf "%-20s %s\n" $j "$(xargs echo < $j)" 1.18 + done ) 1.19 + break 1.20 + done 1.21 + else 1.22 + lsusb -vd $1 | syntax_highlighter lsusb 1.23 + fi 1.24 +} 1.25 + 1.26 lsusb_table() { 1.27 cat <<EOT 1.28 <table class="wide zebra"> 1.29 @@ -40,11 +59,12 @@ 1.30 </thead> 1.31 <tbody> 1.32 EOT 1.33 - lsusb | sed 's|^Bus \([0-9]*\)|<tr><td>\1</td>|; 1.34 - s|</td> Device \([0-9]*\):|</td><td>\1</td>|; 1.35 - s|</td> ID \([^:]*:[^ ]*\)|</td><td><a href="?lsusb=\1">\1</a></td>|; 1.36 - s| |<td>|2; 1.37 - s|.*$|\0</td></tr>|' 1.38 + lsusb | while read x b y d z id name ; do 1.39 + echo "<tr><td>$b</td><td>${d%:}</td><td><a href=\"?lsusb=$id" 1.40 + p=$(printf "class/usb_device/usbdev%d.%d" $b ${d%:}) 1.41 + grep -qs 0 /sys/$p/device/authorized && id="<del>$id</del>" 1.42 + echo "\">$id</td><td>$name</td></tr>" 1.43 + done 1.44 echo "</tbody></table>" 1.45 } 1.46 1.47 @@ -185,7 +205,7 @@ 1.48 EOT 1.49 [ "$vidpid" != 'lsusb' ] && cat <<EOT 1.50 <section> 1.51 - <pre style="white-space: pre-wrap">$(lsusb -vd $vidpid | syntax_highlighter lsusb)</pre> 1.52 + <pre style="white-space: pre-wrap">$(lsusb_vd $vidpid)</pre> 1.53 </section> 1.54 EOT 1.55 ;; 1.56 @@ -407,9 +427,11 @@ 1.57 1) disktype="cd" ;; 1.58 esac 1.59 1.60 + radio="<input type=\"radio\" name=\"device\" value=\"$action $fs\" id=\"${fs#/dev/}\"/>" 1.61 + [ "$REMOTE_USER" == "root" ] || radio="" 1.62 cat <<EOT 1.63 <tr> 1.64 - <td><input type="radio" name="device" value="$action $fs" id="${fs#/dev/}"/><!-- 1.65 + <td>$radio<!-- 1.66 --><label for="${fs#/dev/}" data-icon="$disktype"> ${fs#/dev/}</label></td> 1.67 <td>$(blkid $fs | sed '/LABEL=/!d;s/.*LABEL="\([^"]*\).*/\1/')</td> 1.68 <td>$type</td>
2.1 --- a/po/fr.po Thu Apr 30 02:25:59 2015 +0300 2.2 +++ b/po/fr.po Thu Apr 30 18:37:05 2015 +0200 2.3 @@ -657,7 +657,7 @@ 2.4 2.5 #: hardware.cgi:480 2.6 msgid "Pass" 2.7 -msgstr "Mot de passe :" 2.8 +msgstr "Passe" 2.9 2.10 #: hardware.cgi:502 2.11 msgid "Loop devices"
3.1 --- a/tazpanel Thu Apr 30 02:25:59 2015 +0300 3.2 +++ b/tazpanel Thu Apr 30 18:37:05 2015 +0200 3.3 @@ -41,7 +41,6 @@ 3.4 start Start tazpanel daemon 3.5 stop Stop tazpanel daemon 3.6 restart Restart tazpanel daemon 3.7 - passwd Changing TazPanel password for root (also, short command -p) 3.8 <app> Open TazPanel page in the browser, where <app> is one of: 3.9 boot, hardware, help, index, installer, live, network, settings, pkgs 3.10 If <app> is empty, index page will open in the browser. 3.11 @@ -71,13 +70,6 @@ 3.12 status ;; 3.13 restart) 3.14 tazpanel stop; sleep 1; tazpanel start;; 3.15 - passwd|-p) 3.16 - echo 3.17 - _ 'Changing password for TazPanel' 3.18 - _n 'New password: ' && read pass 3.19 - sed -i "s/\/:root:.*/\/:root:$pass/" $HTTPD_CONF 3.20 - _ 'Password changed successfully' 3.21 - echo ;; 3.22 *) 3.23 . /etc/slitaz/applications.conf 3.24 USER_CONFIG="$HOME/.config/slitaz/applications.conf"