[Pkg-voip-commits] [dahdi-tools] 187/285: xpp: waitfor_xpds: handle missing serial numbers
tzafrir at debian.org
tzafrir at debian.org
Thu Jul 7 19:18:54 UTC 2016
This is an automated email from the git hooks/post-receive script.
tzafrir pushed a commit to branch master
in repository dahdi-tools.
commit 794c8eb0482c5b2a4f5054f9d926e2f66286a14d
Author: Oron Peled <oron.peled at xorcom.com>
Date: Mon Mar 31 13:35:34 2014 +0300
xpp: waitfor_xpds: handle missing serial numbers
Fixes a regression since 949ea4ca9f9c9050811af9e80d44530beb10fd8f
(2.7.0) - allows using an Astribank with no serial.
* Some of the olderst Astribanks don't have a serial number burned in
them. Thus there is no serial attribute for the sysfs USB device node.
* waitfor_xpds identifies the Astribanks by their serial numbers.
* An lone Astribank without serial number would thus block waitfor_xpds
(until timeout).
* Now we warn about them.
* We also try to handle it gracefully. As long as there's only one
of thease, it would be counted as "NO-SERIAL".
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---
xpp/waitfor_xpds | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/xpp/waitfor_xpds b/xpp/waitfor_xpds
index bffa8c2..79e2806 100755
--- a/xpp/waitfor_xpds
+++ b/xpp/waitfor_xpds
@@ -41,18 +41,25 @@ ab_list() {
}
ab_serial_nums() {
- ab_list | \
- sed 's,$,/serial,' | \
- xargs grep -H '' 2>/dev/null | \
- sed 's,.*/serial:,,' | \
- sed 's/^$/NO-SERIAL/' | \
- sort -u
+ for i in `ab_list`; do
+ s=`cat "$i/serial" 2>/dev/null` || :
+ if [ "$s" = '' ]; then
+ echo "NO-SERIAL"
+ else
+ echo "$s"
+ fi
+ done | sort -u || :
}
detected_serial_nums() {
- cat /sys/bus/astribanks/devices/*/transport/serial 2> /dev/null | \
- sed 's/^$/NO-SERIAL/' | \
- sort -u || :
+ for i in /sys/bus/astribanks/devices/*/transport; do
+ s=`cat "$i/serial" 2>/dev/null` || :
+ if [ "$s" = '' ]; then
+ echo "NO-SERIAL"
+ else
+ echo "$s"
+ fi
+ done | sort -u || :
}
calc_union() {
@@ -98,6 +105,14 @@ if ! astribank_is_starting; then
exit 0
fi
+# Sanity check
+for i in `ab_list`; do
+ s=`cat "$i/serial" 2>/dev/null` || :
+ if [ "$s" = '' ]; then
+ echo >&2 "WARNING! Astribank without serial number: $i"
+ fi
+done
+
serial_nums=`ab_serial_nums`
# Loop until detected (hopefully) all astribanks and they are initialized
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git
More information about the Pkg-voip-commits
mailing list