#!/bin/sh
#-------------------------------------------------------------------------------
# charon_menu_aksusbd
#-------------------------------------------------------------------------------
# Copyright (C) 2013-2022 STROMASYS.
# All rights reserved.
#
#-------------------------------------------------------------------------------
#
VERSION=1.4

. /opt/charon/utils/charon_common
. /opt/charon/utils/charon_common_menu

while test 1
do
  display_header "License driver management (aksusbd)"
  echo
  if test `id -u` -ne 0
  then
    tput bold
    echo "Must be root !"
    tput sgr0
    Press_Enter
    echo
    break
  fi

  display_licfound full
#  tput bold
#  echo "HASP dongles connected:"
#  tput sgr0
#  /usr/bin/lsusb -d 0529:0001 -v | grep -e ^Bus -e id*Product
#  test $? != 0 && echo "No HASP dongle connected"
#  echo

  tput bold
  echo "Driver service status:"
  tput sgr0
  /usr/bin/systemctl --lines 0 status aksusbd
  echo

  while test 1
  do
    echo -n "Do you want to restart the service (y/n) (q to quit) ? "
    read ANS
    case "${ANS}"
    in
      y|Y)
        /usr/bin/systemctl restart aksusbd
        break
        ;;
      n|N|q|Q)
        break 2
        ;;
      *)
        break
        ;;
    esac
  done
done

exit
