#!/bin/bash
#
# Install kernel module for special network driver USB Realtec 8150 "rtl8150"
# 
# Parameter $1 for Link/Speed mode
# 0: Autosensing
# 1: 10M/HDx
# 2: 100M/HDx
# 3: 10M/FDx
# 4: 100M/FDx
#
# Parameter $2 for ethernet port


modprobe rtl8150

if   test "$1" = 1; then
  ethtool -s $2 speed 10  duplex half autoneg off
elif test "$1" = 2; then
  ethtool -s $2 speed 100 duplex half autoneg off
elif test "$1" = 3; then
  ethtool -s $2 speed 10  duplex full autoneg off
elif test "$1" = 4; then
  ethtool -s $2 speed 100 duplex full autoneg off
else
  ethtool -s $2 autoneg on
fi

