I can run the following command to enable USB tethering when my device is connected
adb shell service call connectivity 33 i32 1 s16 text
and to disable it
adb shell service call connectivity 33 i32 0 s16 text
I have tested both of these commands and they are working.
I want to execute the first command whenever my device is connected to my pc. I know it can be done using something called a udev rule but I don't know how.