1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-15 04:42:06 +00:00

since we relaxed the permissions to talk to wifid and wfdctl, so there is

no need to run miracle-wfdctl-demo with sudo. but to kill these two
privileged services, the killall still need sudo
This commit is contained in:
Derek Dai 2017-03-03 11:27:51 +08:00
parent cb821562ed
commit 0e1f3243bc
No known key found for this signature in database
GPG key ID: E109CC97553EF009

View file

@ -103,6 +103,7 @@ get_prop()
cleanup() cleanup()
{ {
trap '' TERM
set +e set +e
while (( 0 != ${#cleanup[@]} )); do while (( 0 != ${#cleanup[@]} )); do
eval ${cleanup[${#cleanup[@]}-1]} eval ${cleanup[${#cleanup[@]}-1]}
@ -148,10 +149,12 @@ peer_disconnect()
Disconnect Disconnect
} }
killall miracle-wifid &>/dev/null || true sudo killall miracle-wifid &>/dev/null || true
killall miracle-wfwctl &>/dev/null || true sudo killall miracle-wfwctl &>/dev/null || true
trap cleanup EXIT trap cleanup EXIT
trap 'exit 0' TERM
trap '' CHLD
set_prop org.freedesktop.NetworkManager \ set_prop org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager/Devices/"$nm_link_index" \ /org/freedesktop/NetworkManager/Devices/"$nm_link_index" \
@ -177,6 +180,7 @@ set_prop org.freedesktop.miracle.wifi \
P2PScanning b true P2PScanning b true
cleanup_push link_stop_p2pscan cleanup_push link_stop_p2pscan
echo connect to peer... echo connect to peer...
dump_packets &
invoke org.freedesktop.miracle.wifi \ invoke org.freedesktop.miracle.wifi \
/org/freedesktop/miracle/wifi/peer/$peer_id \ /org/freedesktop/miracle/wifi/peer/$peer_id \
org.freedesktop.miracle.wifi.Peer \ org.freedesktop.miracle.wifi.Peer \
@ -190,7 +194,7 @@ get_prop org.freedesktop.miracle.wifi \
tcpdump -nnvvXS -s 0 -i $p2p_iface port 7236 or port 67 or port 68 & tcpdump -nnvvXS -s 0 -i $p2p_iface port 7236 or port 67 or port 68 &
cleanup_push "kill $!" cleanup_push "kill $!"
while ! killall -0 miracle-wfdctl && [[ -z "$nocheck" ]] &>/dev/null; do while [[ -z "$nocheck" ]] && ! killall -0 miracle-wfdctl &>/dev/null; do
echo please run miracle-wfdctl manually echo please run miracle-wfdctl manually
sleep 3 sleep 3
done done