#!/bin/bash
#
# simple none interactiv handler for Bluetooth PIN's
# /etc/bluetooth/pin must only contain one line with the
# PIN code
#

# if e.g. kbluetoothd is not running, kbluepin throws an error and returns 1
KBLUETOOTHD_RUN=`ps -ea|grep kbluetoothd`
if [ -f /opt/kde3/lib/kdebluetooth/kbluepin \
   -a -x /usr/X11R6/lib/sax/tools/testX \
   -a "X$KBLUETOOTHD_RUN" != "X" ]; then
   /usr/X11R6/lib/sax/tools/testX --fast && \
	exec /opt/kde3/lib/kdebluetooth/kbluepin ]
fi;

echo -n "PIN:"
cat /etc/bluetooth/pin
