Stop RF Gun Wireless disconnects

[From]: http://www.precisonline.com/forum/index.php/topic,245.0.html

We had a problem with our RF barcode scanners that we use in our warehouse for inventory: every once in a while, they’d lose the connection to the host.  Sometimes when the connection got dropped, they’d be in the middle of picking an order, and the dropped connection left the order in a messy state.

In order to mitigate this problem, we use screen http://www.manpagez.com/man/1/screen/ (AIX RPMs here: http://www.oss4aix.org/download/RPMS/screen/) to abstract the session on the RF device — if the connection drops, the same user can just log back in and resume the screen session.  One caveat — screen is for all intents and purposes a VT100 terminal emulator, so you have to make sure that whatever you’re connecting to (in our case Prelude) is expecting VT100, and the device you’re using is expecting the same.

To automate this, part of the login script for our RF gun users is:

#!/bin/sh
export TERM=vt100

if screen -ls | grep "No Sockets found" > /dev/null 2>&1
  then
  screen -s /usr/local/bin/prelude.login
  exit 0
else
  SCREEN=`screen -ls | grep -v "screen" | awk '{print $1}'`
  echo "You are already logged on."
  echo "What do you want to do:"
  echo "1 - Resume Previous Session"
  echo "2 - Start a New Session"
  while [ ! "$yn" = "1" ] && [ ! "$yn" = "2" ]
    do
    echo "Please enter 1 or 2."
    read yn
  done
  if [ "$yn" = "1" ]
    then
    screen -D -R $SCREEN
  fi
  if [ "$yn" = "2" ]
    then
    screen -s /usr/local/bin/prelude.login
  fi
fi

exit 0
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s