#!/bin/sh
BLUETOOTH_CONFIG=/etc/sysconfig/bluetooth
test -r $BLUETOOTH_CONFIG && $BLUETOOTH_CONFIG

#add for Ralink Bluetooth [148f:1000] and [148f:2000]
RALINK_RT3090=`/usr/bin/lsusb | grep -o "148f:1000"`
RALINK_Rashia2=`/usr/bin/lsusb | grep -o "148f:2000"`

if [ "$RALINK_RT3090" =="148f:1000" ] || [ "$RALINK_Rashia2" == "148f:2000" ]; then
	BT_STATUS=`/usr/sbin/bccmd psread | grep -o "\&028c = 0000"`
	if [ "$BT_STATUS" == "&028c = 0000" ]; then
		/usr/sbin/bccmd psset -r 0x028c 0x0001
	fi
fi

if [ "$START_BLUETOOTHD" = "no" ]; then
	exit 0
fi

exec /usr/sbin/bluetoothd --udev
