xpp/astribank_hook: remove Astribank initialization
authorOron Peled <oron.peled@xorcom.com>
Tue, 28 Oct 2014 17:43:48 +0000 (13:43 -0400)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Thu, 6 Nov 2014 11:29:19 +0000 (13:29 +0200)
If this is the last seen Astribank

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

xpp/astribank_hook

index 59c79ea..05d1c17 100755 (executable)
@@ -172,6 +172,13 @@ old_synchronous_stop() {
        fi
 }
 
+ab_list() {
+       find /sys/devices -name idVendor 2>/dev/null | \
+               xargs grep -H  'e4e4' 2>/dev/null | \
+               sed -e 's/idVendor.*/idProduct/' | xargs grep -H '11[3456]' | \
+               sed 's,/[^/]*$,,' || :
+}
+
 tws_watchdog_enable() {
        devdir="/sys$DEVPATH"
        label=`cat "$devdir/label"`
@@ -197,6 +204,11 @@ case "$ACTION" in
 add)
        ;;
 remove)
+       ab=`ab_list | wc -l`
+       if [ "$ab" -eq 0 ]; then
+               $LOGGER "$prefix: No more Astribanks -- remove astribank_is_starting semaphore"
+               astribank_is_starting -v -r 2>&1 | $LOGGER
+       fi
        ;;
 online)
        if can_full_async; then