I've been able to get the udev rules to work to start and stop the service on plug. The only issue I have is thatit fails to discover a valid GOPRO_IP the first time, but when the the service restarts it finds it. Is there a way so it doesn't failthe first time?
First run
Apr 12 17:09:26 samticus-comouman systemd[1]: Started GoPro Webcam start script.
Apr 12 17:09:26 samticus-comouman gopro[165927]: Running GoPro Webcam Util for Linux [0.0.3]
Apr 12 17:09:26 samticus-comouman gopro[165927]: Launch Options
Apr 12 17:09:26 samticus-comouman gopro[165927]: ==========================
Apr 12 17:09:26 samticus-comouman gopro[165927]: * Non-interactive: 1
Apr 12 17:09:26 samticus-comouman gopro[165927]: * Autostart: 1
Apr 12 17:09:26 samticus-comouman gopro[165927]: * Preview: 0
Apr 12 17:09:26 samticus-comouman gopro[165927]: * Device Pattern: enp
Apr 12 17:09:26 samticus-comouman gopro[165927]: ==========================
Apr 12 17:09:26 samticus-comouman gopro[165927]: v4l2loopback is loaded!
Apr 12 17:09:26 samticus-comouman gopro[165927]: v4l2loopback was unloaded successfully.
Apr 12 17:09:26 samticus-comouman gopro[165927]: v4l2loopback was successfully loaded.
Apr 12 17:09:26 samticus-comouman gopro[165927]: Using provided device pattern enp
Apr 12 17:09:26 samticus-comouman gopro[165927]:
Apr 12 17:09:26 samticus-comouman gopro[165927]: Discovered: enp1s0f0u4.
Apr 12 17:09:26 samticus-comouman gopro[165927]: Using enp1s0f0u4 to discover the GOPRO_IP.
Apr 12 17:09:26 samticus-comouman gopro[165927]: Could not automatically discover a valid GOPRO_IP. Use the '-p, -d or -i' option to provide more information. (see --help for more information)
Apr 12 17:09:26 samticus-comouman systemd[1]: gopro_webcam.service: Main process exited, code=exited, status=1/FAILURE
Apr 12 17:09:26 samticus-comouman systemd[1]: gopro_webcam.service: Failed with result 'exit-code'.
Apr 12 17:09:41 samticus-comouman systemd[1]: gopro_webcam.service: Scheduled restart job, restart counter is at 1.
Apr 12 17:09:41 samticus-comouman systemd[1]: Stopped GoPro Webcam start script.
Restart
Apr 12 17:09:41 samticus-comouman systemd[1]: Started GoPro Webcam start script.
Apr 12 17:09:41 samticus-comouman gopro[166016]: Running GoPro Webcam Util for Linux [0.0.3]
Apr 12 17:09:41 samticus-comouman gopro[166016]: Launch Options
Apr 12 17:09:41 samticus-comouman gopro[166016]: ==========================
Apr 12 17:09:41 samticus-comouman gopro[166016]: * Non-interactive: 1
Apr 12 17:09:41 samticus-comouman gopro[166016]: * Autostart: 1
Apr 12 17:09:41 samticus-comouman gopro[166016]: * Preview: 0
Apr 12 17:09:41 samticus-comouman gopro[166016]: * Device Pattern: enp
Apr 12 17:09:41 samticus-comouman gopro[166016]: ==========================
Apr 12 17:09:41 samticus-comouman gopro[166016]: v4l2loopback is loaded!
Apr 12 17:09:41 samticus-comouman gopro[166016]: v4l2loopback was unloaded successfully.
Apr 12 17:09:41 samticus-comouman gopro[166016]: v4l2loopback was successfully loaded.
Apr 12 17:09:41 samticus-comouman gopro[166016]: Using provided device pattern enp
Apr 12 17:09:41 samticus-comouman gopro[166016]:
Apr 12 17:09:41 samticus-comouman gopro[166016]: Discovered: enp1s0f0u4.
Apr 12 17:09:41 samticus-comouman gopro[166016]: Using enp1s0f0u4 to discover the GOPRO_IP.
Apr 12 17:09:41 samticus-comouman gopro[166016]: Found 172.27.199.54
Apr 12 17:09:41 samticus-comouman gopro[166016]: To control the GoPro, we need to contact another interface (GOPRO_IP ending with .51).. Adapting internally..
Apr 12 17:09:41 samticus-comouman gopro[166016]: Now using this GOPRO_IP internally: 172.27.199.51
I think this is because the GoPro takes some time to initialize. Maybe if given the -n option you insert a delay before trying to find the IP? That may fix it.
I've been able to get the udev rules to work to start and stop the service on plug. The only issue I have is thatit fails to discover a valid GOPRO_IP the first time, but when the the service restarts it finds it. Is there a way so it doesn't failthe first time?
First run
Restart
My modified 60-gopro.rules
My modified gopro_webcam.service