#!/bin/bash

if [ $(cat /proc/cpuinfo |grep ^Hardware|grep sun7i| wc -l) -eq 0 ] ; then
        exit
fi

echo -n "  $(basename $0) - tunning cubieboard... "

ifconfig eth0 txqueuelen 10000

taskset -pca 0,1 $(pgrep mpd)

pgrep cifsd && chrt -f -p 49 $(pgrep cifsd)

echo 0 > /sys/class/leds/green\:ph20\:led1/brightness

for CPU in /sys/devices/system/cpu/cpu[0-9]/cpufreq/ ; do
	echo performance > $CPU/scaling_governor
done

if [ $(uname -v | grep RT | wc -l ) -eq 1 ] ; then
	echo -n "tunning realtime... "
	for PID in $(pgrep ehci) ; do chrt -f -p 54 $PID; done
	#for PID in $(pgrep eth) ; do chrt -f -p 49 $PID; done
fi

echo "Done."
