This is not i.mx related but you do need to learn udev. When a usb device is plugged, /sbin/hotplug binary will be called with the following arguments:
[0] = hotplug path
[1] = "usb"
[2] = 0
And the hotplug environment variables to be set are:
ACTION=action
PRODUCT=idVendor/idProduct/bcdDevice
TYPE=device_class/device_subclass/device_protocol