1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-13 03:41:59 +00:00
Commit graph

114 commits

Author SHA1 Message Date
Andrey Gusakov
6de9b112d8 Lease IP on REQUEST if address is free
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:38 +02:00
Andrey Gusakov
7d936b3cdf Do not fail if host name cannot be read over DBUS
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:38 +02:00
Andrey Gusakov
026e7ea095 Set Miracle as device name if no frindly_name set
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:38 +02:00
Andrey Gusakov
4d9cd01606 Do not use udev tags
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:37 +02:00
Andrey Gusakov
16d90afcd2 Remove unnecessary close body and close head
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:37 +02:00
Andrey Gusakov
066eca8638 RTSP: close message header and body on fail
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
2015-03-30 12:06:37 +02:00
Andrey Gusakov
5fc9133a60 sink: fix session ID extraction
Devices sometimes report sessions followed by ";timeout=..". Cut this off.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:44:40 +02:00
Andrey Gusakov
06d7dce2ec wifi: report formation failture if pending peer is lost
Properly notify API users if we free peers that are pending. This way,
they don't have to use timers to restart peer discovery on wpa_supplicant
failures.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:42:16 +02:00
Andrey Gusakov
204fa269e3 wifi: do not start new connections if one is already pending
If there is already a connection pending, don't start a new one.
Unfortunately, wpa_supplicant is unable to deal with this so we have to
enforce this.. Yuck!

We also reset the pending state during P2P_FIND now, this enables API
users to reset failed connections that wpa_supplicant was unable to close
(yeah, beacuse it's so hard to write proper APIs.. *sigh*).

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:39:08 +02:00
Andrey Gusakov
e79f08dd25 wifi: p2p_connect does not need display parameter
No need to add 'display' to p2p_connect commands. Drop it for future
compatibility.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:34:14 +02:00
Andrey Gusakov
e81f5e2833 sink: use RTSP_CODE_OK
Avoid magic numbers when creating rtsp responses, use RTSP_CODE_*
constants instead.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:11:53 +02:00
Andrey Gusakov
67ad486765 wifi: check device_name and name in supplicant_parse_peer()
P2P-PEER reports the device name as 'device_name' while P2P-DEVICE-FOUND
reports it as 'name'. Try both.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:11:13 +02:00
Andrey Gusakov
dbf3972619 sink: add arguments to enable/disable audio and scaling
Forward the --audio and --scale arguments to our gst-spawn helper and
parse them via bash for now.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:11:13 +02:00
Andrey Gusakov
e7aa531dca sink: move GST pipeline construction to bash script
The sinkctl tool is currently a hack to make Miracast sinks work. The
embedded gst-launch invocation is kinda ugly to handle. Move it into a
bash-script so we can experiment a bit more with different pipelines.
Ultimatively, the goal is obviously to make this work as its own gst
element.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 08:11:03 +02:00
Andrey Gusakov
5fabb386b8 build: drop /usr/local from include path
We now use the pkg-config snippet of libsystemd, so no need to add
host-local include paths, anymore.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 07:55:42 +02:00
Andrey Gusakov
76b736aca3 build: fix required package to libsystemd
We require libsystemd, not libsystemd-daemon. Fix the pkg-config test and
also adjust the version.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-09-03 07:54:24 +02:00
David Herrmann
b7d04aa20d sink: exit header/body in case rtsp_message_readv() fails
rtsp_message_readv() is a convenience function. If one of the values to be
read fails, it does not restore the previous situation. Therefore, handle
that in sinkctl in case we cannot read a value.

Reported-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-15 15:53:25 +02:00
Andrey Gusakov
9b801d6b0e wifi: reformat MACs returned from DHCP
ether_ntoa() function used in DHCP server skips leading zeros so
reformat is needed to make strcmp() work for mac-comparisons.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-13 08:52:08 +02:00
Andrey Gusakov
e40f7f744e shared: format MAC with leading zeros
Don't skip leading zeroes for MAC addresses. Some software cannot handle
this well.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-13 08:48:21 +02:00
David Herrmann
7c87510b34 dhcp: sync with gdhcp
Copy over recent changes to gdhcp from ConnMan. We should really start
exporting sd-dhcp from libsystemd so we can finally drop this alltogether.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-13 08:45:15 +02:00
Andrey Gusakov
eecf576fa9 wifi: fix possible null-pointer dereference on sta_mac
p->sp->sta_mac is not mandatory set so check it before accessing it.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-13 08:30:56 +02:00
Thomas Hindoe Paaboel Andersen
58c76ccfd1 README: bump dependency on systemd
97323d905c increased the required
version of systemd to >= 213

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-08 15:16:18 +02:00
Thomas Hindoe Paaboel Andersen
f489b45f9a ctl: remove unused variables
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-08 15:15:43 +02:00
Andrey Gusakov
60e2254e9e ctl: save wfd_presentation_URL from M4
M6 M7 messages should use URL from wfd_presentation_URL of M4. Parse it
during set_parameter and use it in further requests instead of a
hard-coded URL.

Signed-off-by: Andrey Gusakov <adnrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 13:30:35 +02:00
Andrey Gusakov
40484a022a ctl: divide M6 (SETUP) and M7 (PLAY) stages
In M7 message session ID should be included. Session ID is returned in M6
response. So we should wait for M6 response.

Signed-off-by: Andrey Gusakov <adnrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 13:21:02 +02:00
David Herrmann
67de17a511 rtsp/wpas: pass va_list by reference
As it turns out, the C standard forbids passing va_list by value and then
continue using it in the parent function (C Standard, 7.16, paragraph 3).

Luckily, there's a footnote stating:
    "It is permitted to create a pointer to a va_list and pass that
    pointer to another function, in which case the original function may
    take further use of the original list after the other function
    returns."

Therefore, we're safe passing va_list by reference and thus can keep the
current coding style.

This fixes weird bugs on ARM32 which really doesn't allow passing va_list
by value.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 13:10:03 +02:00
Andrey Gusakov
9196c5c426 wifi: handle P2P_GROUP_FORMATION_FAILURE
Forward group-formation-failure events via dbus so sinkctl can restart
p2p-scans immediately. Unfortunately, the event itself does not contain
any useful information at all. Therefore, we have to track the connection
attempts ourselves.

Signed-off-by: Andrey Gusakov <adnrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 13:02:18 +02:00
Andrey Gusakov
2a84a2d868 dbus: use 'int' instead of 'bool' in sd_bus
sd_bus never uses 'bool', and given the weird implicit type promotions, it
is totally right to do so. Make sure we never pass pointers to 'bool' to
va_arg sd_bus functions to avoid overwriting stack space.

Signed-off-by: Andrey Gusakov <adnrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 12:37:20 +02:00
Andrey Gusakov
97323d905c dbus: update to systemd API >=213
The libsystemd-bus API changed recently. Update our calls to use the new
API so it compiles with newer systemd versions.

Signed-off-by: Andrey Gusakov <adnrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-05 11:57:56 +02:00
David Herrmann
3dcb89e98b shl: update shl-macro.h
Fix a bug in SHL_ALIGN_POWER2 and add new shl_closep helpers.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-12 14:32:41 +02:00
David Herrmann
5c88e3df66 build: update README
Update some old information in README.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-09 09:39:44 +02:00
David Herrmann
7a73bee0f0 build: remove libwfd dependency
libwfd is no longer used, remove the dependency.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-09 09:39:22 +02:00
David Herrmann
0f9ca6e7b8 build: adjust to new libsystemd-event API
The individual timer-sources were replaced by a unified timer-source.
Adjust to that.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-09 09:29:39 +02:00
David Herrmann
37c2169c9e ctl: spawn gstreamer on sink-connect
Once we have a source connection to our local sink, spawn gstreamer so the
actual video data is rendered.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-09 09:28:57 +02:00
David Herrmann
4907155317 ctl: add sinkctl
miracle-sinkctl is a very basic Miracast-Sink implementation. It is meant
for debugging and as proof-of-concept.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 15:29:46 +02:00
David Herrmann
95866f54f4 ctl: advertise wifi-connected changes after updating props
If we advertise changes in Peer.Connected _before_ updating other props,
they're not available in the callbacks. Delay the notifications after we
parsed all props.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 15:23:53 +02:00
David Herrmann
f275a60401 rtsp: strip remote-cookie during reply-matching
We need to drop the remote-cookie flag when matching replies. Otherwise,
we will never find the local request.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 15:23:17 +02:00
David Herrmann
4ea4bb7d82 wifi: parse P2P_DEVICE_FOUND immediately
If we delay device-parsing until P2P_PEER returns, we might receive other
device events in between which we cannot handle as the peer is unknown.
Avoid that by immediately creating the peer and appending more detailed
data later once P2P_PEER returns.

As P2P_PEER keys and P2P_DEVICE_FOUND keys are different (wholy shit, what
a fucking interface), we need to parse both. Lets hope there won't be any
conflicts.

WARNING: The wfd_subelements field is currently very inconsistent.
Sometimes we only use dev_info fields, somethings the whole IE. Users
shall use it as boolean value, only (set vs. unset). Once we add a proper
IE parser, we will provide more advanced fields.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 12:24:19 +02:00
David Herrmann
f6e434e86a rtsp: add rtsp bus
WifiDisplay uses RTSP for stream-setups. This adds a basic rtsp-bus
implementations that we can use for sinks and sources.

Note that the implementation is optimized for usability, not speed. RTSP
is used for control-data, not streaming-data so there's no need to
over-optimize it. In case inlined RTP is used, we still provide proper
speed, even though that's usually not used by WifiDisplay implementations
(due to the TCP requirement).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:39:02 +02:00
David Herrmann
0d5b431367 ctl: make cli_bus and cli_event global
The event-loop might be needed in later ctl additions for timeouts, so
make it global. Same for the bus-logic.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:35:33 +02:00
David Herrmann
430d565ccc wifi: declare supplicant_set_wfd_subelements()
The declaration is missing, add it to suppress 'unknown function'
warnings.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:34:51 +02:00
David Herrmann
b3f4527444 ctl: suppress unused-result warnings
Use the 'v' variants of cli_vENOMEM() if the result is unused.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:34:17 +02:00
David Herrmann
63a0580695 wifi: send P2P_FIND on each p2p_scan() request
wpa_supplicant is horrible in notifying us about p2p-scans. During failed
connection attempts or other timeouts, we usually are not notified about
scan-stops. Therefore, a following p2p-scan will simply be ignored as we
think it's still running.

Avoid that problem by always forwarding the P2P_FIND command.
wpa_supplicant can deal with redundant requests so we're fine. Note that
this requires the caller to issue these calls in intervals or/and after
any issues wifi request. Once wpas fixes this issue, we can add this guard
again and the redundant requests will be suppressed.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:11:02 +02:00
David Herrmann
b5f4870edc test: include sys/socket.h to suppress warnings
We use pipes and socketpairs, so include socket.h.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:07:30 +02:00
David Herrmann
e2781c0a7a wifi: fix unused-result warning in log_ENOMEM()
Use log_vENOMEM() as we don't use the return-code.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-05-08 11:06:07 +02:00
David Herrmann
78cf818484 ctl: publish objects after parsing properties
Delay object-broadcasts so we first parse properties and then advertise
the objects. Otherwise, the caller will get almost empty objects which are
rather useless.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-04-23 12:30:20 +02:00
David Herrmann
d0a85ac46c ctl: parse wfd-subelements
Parse and show wfd-subelements.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-04-23 12:09:03 +02:00
David Herrmann
e624d5f81a wifi: add wfd-subelement properties
Allow dbus API users to read and modify WFD subelements.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-04-23 12:07:23 +02:00
David Herrmann
61db4a1d71 shl: fix shl_qstr_tokenize() quote parser
The parser is simply broken, fix it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-03-29 12:51:40 +01:00
David Herrmann
9cb0a092c2 test: add valgrind memory checks
Copy over the "make memcheck" target from libshl. It runs the test-suite
again via valgrind and fails on any valgrind warnings. This is very useful
to find memory-leaks and invalid memory-accesses via the test-suite.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-03-28 12:48:10 +01:00