I was wondering whether it is possible to write Linux Drivers for the 3.5mm jack to use it for non-audio purposes. How does the linux kernel identify that a device is inserted into the 3.5mm slot? What are the interfaces in the linux kernel I could use for this purpose?