Browse code

readme and advanced Bashscript

dewomser authored on12/03/2017 14:22:43
Showing1 changed files

1 1
new file mode 100755
... ...
@@ -0,0 +1,17 @@
1
+#!/bin/bash
2
+echo ""
3
+echo -e "\e[1;4m ## Maximal current allowed from all USB "
4
+zaehl=$(lsusb -s 001|wc -l)
5
+for (( i=1; i <= $zaehl; i++ ))
6
+do
7
+wert=$(lsusb -v -s $i: 2>&1 | grep MaxPower | sed 's/MaxPower//;s/mA//') 
8
+echo -e "\e[0m Bus $i $(dc <<< '[+]sa[z2!>az2!>b]sb'"${wert[*]}lbxp") mA" 
9
+done
10
+echo "---------------------------"
11
+wert=$(lsusb -v 2>&1 | grep MaxPower | sed 's/MaxPower//;s/mA//') 
12
+echo "Bus ∑ $(dc <<< '[+]sa[z2!>az2!>b]sb'"${wert[*]}lbxp") mA"
13
+echo ""
14
+echo -e "\e[1;4m ## All devices, maximal current"
15
+wert=$(lsusb -v  2>&1 | grep  '\(id[PV]\|MaxPower\)' | sed 's/idProduct// ; s/idVendor//'|sed 's/^[ \t]*// ; s/0x[A-Za-z0-9]*// '|sed 's/^[[:blank:]]*$/not defined/' )
16
+echo -e "\e[0m $wert"
17
+echo ""