#!/bin/bash

[[ "$ACTION" != "add" ]] && exit 0

ID=${DEVPATH##*/}

# if device is bound to ums-realtek, return
[[ -e "/sys/bus/usb/drivers/ums-realtek/$ID:1.0" ]] && exit 0

# unbind device from usb-storage and rebind it to ums-realtek
echo -n $ID:1.0 > /sys/bus/usb/drivers/usb-storage/unbind
echo -n $ID:1.0 > /sys/bus/usb/drivers/ums-realtek/bind
