1 Answer
1

When you connect a usb device to your PC, a service called udev manages the work of connecting it, enabling the appropriate driver, etc. To do what you need to do, you need to write udev rules to control its behaviour.

You can look at this article for some examples of how to control it. I am afraid I don't know it in enough detail to explain how to achieve what you want particularly, but udev is the answer.