Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions gopro
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,28 @@ function discover_device {
GOPRO_DEVICE=${dev}
}

# configure (fixup) NetworkManager's automatically created connection
# which may e.g. have a type "shared", what prevents the interface from getting correct IP address from GoPro
function configure_nm_connection {
GOPRO_NM_CONN=$(nmcli -t -f GENERAL.CON-UUID device show enp4s0f4u1 | awk -F: '{print $2}')

if echo $GOPRO_NM_CONN | grep -E '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' &> /dev/null; then
conn_method=$(nmcli -t -f ipv4.method conn show ${GOPRO_NM_CONN})
if [[ "$conn_method" == "ipv4.method:auto" ]]; then
green "NetworkManager's connection method is auto."
else
yellow "NetworkManager's connection method is not auto, setting ..."
nmcli conn modify "${GOPRO_NM_CONN}" ipv4.method auto
nmcli conn down "${GOPRO_NM_CONN}"
nmcli conn up "${GOPRO_NM_CONN}"
yellow "Connectio method is set to auto."
fi
else
yellow "No NetworkManager connection found to fixup."
fi

}

function find_gopro_ip {

if [[ ! ${GOPRO_IP} ]]; then
Expand Down Expand Up @@ -366,6 +388,8 @@ function start_webcam {
discover_device
fi

configure_nm_connection

find_gopro_ip

start_gopro_webcam_mode
Expand Down