If we stop a scan in an async-manner and the object is no longer around,
don't print an error. Only do that if the scan is stopped explicitly by
the user.
This allows us to correctly kill scans during link-removal in a follow-up
patch. In such cases, the scan-stop may fail of the dbus object has
already been removed.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
We currently suppress all log-messages except FATAL, which is not really
what we want. Initialize the log-level to NOTICE like the default for
shl_log is, too.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add readline support to miraclectl so we can have interactive commands.
This rewrites huge parts of miraclectl but hopefully makes it future proof
so no such rewrite will be needed again.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add few small helpers to shl-macro/util. This includes some _cleanup_
helpers and the qstr suite for quoted/escaped strings.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Print more information now that we have property-support in miracled. Also
split link and peer information, otherwise the output looks misleading.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
The add-link argument turned out to be confusing so avoid the split input
and use the same name as all the other commands. We now split it
internally so the DBus call will work properly.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Three new commands that control scans on a given link are added:
1) start-scan: Starts scanning in background for a given link
2) stop-scan: Stops scanning in background for a given link
3) scan: Does interactive scanning for a given link
The interactive scanning basically calls start-scan and stop-scan. In
between, it listens for dbus-signals for new peers and displays them if
they are assigned to the given link. This should be used for basic
p2p-device scanning on a link.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
If we don't split peer linking off, the peer might get advertised before
the sub-device related data is set. With dbus, this might trigger
callbacks to not return attributes as the peer-type is unknown. Therefore,
properly initialize the peer before linking/advertising it.
This fixes a bug where the initial InterfacesAdded signal for new peers
does not include all properties of a peer.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Both dbus commands allow external programs to make our device discoverable
for P2P devices and also start scanning for remote devices.
The commands are *not* ref-counted right now, so parallel use is
discouraged. However, these commands can interrupt normal operations on a
wifi-device anyway, so if used in parallel, it is very like to break.
Thus, keep the interface simple and require callers to do
access-management (it's root-only, anyway..).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Send ObjectManager.Interfaces{Added,Removed} signals whenever new objects
appear. Note that we cannot set DBus interfaces there as sd-bus ignores
them. We'll try to fix that upstream and until then just not expose any of
those.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
We need to send PropertiesChanged signals whenever we change properties
that are annotated as such.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This command prints detailed information on a given peer. This is exactly
the same as 'show-link' but for peers.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Implement basic peer properties and hook them up with dbus. Also add a
device_name parser to the wifi implementation so we correctly read the
friendly-name of remote devices.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Move peer_make_name() to the top to keep consistency with miracled-link.c
and move non-object-based helpers to the top.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
The new show-link command lists detailed information of a given link.
Useful for debugging and introspection.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
The friendly-name is used as name for local links. Default to a random
string and try to read the local hostname during startup.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This initial commit contains the main "miracled" daemon that does
link-management and peer-discovery/control. The "miraclectl" tool can be
used to control this daemon during runtime.
Note that this implementation is still missing a lot of stuff. All it
currently does is provide link-management and basic peer-discovery.
Following commits will hook everything else up.
The actual Miracast/Wifi-Display related runtime control is not being
worked on, yet. Feel free to use the proof-of-concept from the OpenWFD
repository. The MiracleCast implementation will not get any such
functionality unless the basic link-management is properly working.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>