xpp: waitfor_xpds: handle missing serial numbers
Fixes a regression since 949ea4ca9f
(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@xorcom.com>
This commit is contained in:
parent
ffe36c63e0
commit
794c8eb048
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user