Trying to run a script when my phone is plugged in via USB. I made a udev rule in /etc/udev/rules.d/85-lazydroid.rule that looks like this:
ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="428c", RUN+="/home/joel/.lazydroid"
And the script .lazydroid
looks like this:
#!/bin/bash
exec adb forward tcp:8080 tcp:8080 &
exec chromium-browser 127.0.0.1:8080 --new-window &
The script itself runs fine, but the thing is, I can't get the script to run upon insertion of the phone.
It has the right ID according to lsusb | grep Motorola
Bus 002 Device 042: ID 22b8:428c Motorola PCS
Any ideas?
[EDIT]
Okay, now I know the udev rule is running, as it creates the symlink. I made some changes to the rule, see below:
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="428c", SYMLINK+="phone", RUN+="/bin/sh /home/joel/.lazydroid.sh"
But the script still won't run. And if I run it separately it still runs perfectly.