1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 19:11:58 +00:00
Commit graph

329 commits

Author SHA1 Message Date
David Herrmann
eaea59d324 res: add wpa.conf example
Add example file for wpa_supplicant so users can start testing.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 15:23:03 +01:00
David Herrmann
6fbd58e349 miraclectl: hook up connection API
Add commands for allow/reject/connect/disconnect and parse all events
properly. Notify the user of any important changes so they can react to
it.

Note that Peer.Connect() is currently not implemented and will stay this
way until we have the dhcp-server and wfd-source ready (or at least
planned).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 15:06:24 +01:00
David Herrmann
01292905f0 miracled: send PropsChanged event on explicit peer-disconnect
If we explicitly call wifi_dev_disconnect(), no WIFI event is broadcasted,
so handle it manually and send a dbus event if it changed.

Note that we explicitly call into wifi even if the device is not connected
to kill any ongoing connection attempts.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 15:05:10 +01:00
David Herrmann
9212e72c52 miraclectl: fix crash during shutdown and scan-stop
Fix a NULL deref during shutdown if we try to stop a non-existant scan.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 14:34:13 +01:00
David Herrmann
dd3c8eac9c miracled: hook up peer-connection with dbus
Hook up the peer-dbus API with the underlying peer objects. This allows to
handle incoming requests and deal with connection issues.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 14:27:14 +01:00
David Herrmann
146cf0bdb0 miraclectl: stop scan on link-removal
If a link is removed, stop any pending interactive scan-tracking.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 14:13:41 +01:00
David Herrmann
1b1000b254 miraclectl: fix link/peer event formatting
Add colons so the event content is better readable on the CLI.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-11 14:13:01 +01:00
David Herrmann
12bf86c744 miraclectl: suppress useless error on scan-stop
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>
2014-02-11 14:11:26 +01:00
David Herrmann
1c470e46a8 miraclectl: set default log-level to NOTICE
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>
2014-02-11 14:06:23 +01:00
David Herrmann
650920082c miraclectl: use readline
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>
2014-02-11 11:34:33 +01:00
David Herrmann
0ce874d7ce shl: update macro/util helpers
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>
2014-02-11 11:33:47 +01:00
David Herrmann
fe11d1d863 miraclectl: improve verb_list output
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>
2014-02-10 18:51:40 +01:00
David Herrmann
3b188989db miraclectl: fix printf offset for CONNECTED properties
We need at least 9 chars for the string "CONNECTED"..

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 18:51:11 +01:00
David Herrmann
bbe1050906 miraclectl: make add-link accept a single argument
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>
2014-02-10 18:36:29 +01:00
David Herrmann
44574b1d81 miraclectl: add scan commands
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>
2014-02-10 18:29:06 +01:00
David Herrmann
837fe1cea1 miracled: split peer allocation and linking
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>
2014-02-10 18:27:21 +01:00
David Herrmann
e60e678d40 miracled: implement Start/StopScan
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>
2014-02-10 16:56:59 +01:00
David Herrmann
8bcf3348e8 miracled: implement InterfacesAdded/Removed
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>
2014-02-10 16:29:02 +01:00
David Herrmann
5d5ab7761f miracled: implement PropertiesChanged signals
We need to send PropertiesChanged signals whenever we change properties
that are annotated as such.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 15:57:02 +01:00
David Herrmann
14ca5829b2 miraclectl: add 'show-peer' verb
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>
2014-02-10 14:59:16 +01:00
David Herrmann
fde71e7352 miracled: implement peer properties
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>
2014-02-10 14:58:32 +01:00
David Herrmann
7457a7cf90 miracled: move peer_make_name() definition
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>
2014-02-10 14:22:33 +01:00
David Herrmann
4879057c01 miraclectl: add 80-char marker
Add a marker with 80-char width so the help text will get proper sizes.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 14:14:19 +01:00
David Herrmann
d26892b61f miraclectl: add 'set-link-name' verb
The new set-link-name command allows users to change the friendly-name of
a given link.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 14:14:19 +01:00
David Herrmann
a765bd29b8 miraclectl: add 'show-link' verb
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>
2014-02-10 14:14:19 +01:00
David Herrmann
27a74298e9 miracle: add few bus helpers
Two new bus helpers to deal with common sd-bus tasks.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 14:14:19 +01:00
David Herrmann
2e50d006ad miracled: friendly-name support for local links
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>
2014-02-10 12:58:24 +01:00
David Herrmann
062c73ecf3 miracled: move link_make_name() declaration
Make the header consistent and move independent helpers above the real
object handling.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-02-10 12:15:05 +01:00
David Herrmann
051b584746 Initial MiracleCast Implementation
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>
2014-02-09 18:36:06 +01:00