#!/bin/bash
kernel_ver=$(uname -r)
module_name="usb_pqlabs"

echo "testing the \"sudo\" ..."
sudo echo "OK."
if [ $? -ne 0 ]; then
    echo "Failed. please retry later, or switch to \"root\" by \"su\" and retry."
    exit 1
fi

sudo killall -q pqmtpdaemon 
sudo killall -q MultiTouchPlatformHelper

#remove module
if [ "$(lsmod | grep $module_name)" != "" ] ; then
	sudo rmmod $module_name
fi
if [ -e /lib/modules/${kernel_ver}/kernel/drivers/usb/${module_name}.ko ]; then
	sudo rm -f /lib/modules/${kernel_ver}/kernel/drivers/usb/${module_name}.ko
fi
