Merge lp:~morphis/aethercast/mtk-miracast-mode into lp:aethercast

Proposed by Simon Fels
Status: Merged
Approved by: Simon Fels
Approved revision: 150
Merged at revision: 154
Proposed branch: lp:~morphis/aethercast/mtk-miracast-mode
Merge into: lp:aethercast
Diff against target: 72 lines (+15/-4)
3 files modified
conf/aethercast.conf.in (+6/-0)
src/w11tng/networkmanager.cpp (+8/-4)
src/w11tng/networkmanager.h (+1/-0)
To merge this branch: bzr merge lp:~morphis/aethercast/mtk-miracast-mode
Reviewer Review Type Date Requested Status
Konrad Zapałowicz (community) code Approve
Review via email: mp+300078@code.launchpad.net

Commit message

Use a different network device on some devices for sending private driver commands

On devices where we have a dedicated p2p network interface we need to use the real wifi network interface to send private commands to the driver. Otherwise they can't be handled by the driver for the p2p network interface.

To post a comment you must log in.
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

LGTM

review: Approve (code)
150. By Simon Fels

Move variable definition to avoid merge conflict

151. By Simon Fels

Prevent crash on interface setup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'conf/aethercast.conf.in'
2--- conf/aethercast.conf.in 2016-05-31 13:43:18 +0000
3+++ conf/aethercast.conf.in 2016-07-20 12:32:23 +0000
4@@ -17,6 +17,12 @@
5 # not cause any for those which doesn't need any firmware as
6 # the Android WiFi firmware loader should just pass through
7 export AETHERCAST_NEED_FIRMWARE=1
8+
9+ # Not optimal but works for all devices we support right
10+ # now. Generally if something uses a dedicated p2p device we
11+ # we need to use the real wifi device to send any private
12+ # commands to the driver.
13+ export AETHERCAST_DRIVER_CMD_IFACE=`getprop wifi.interface`
14 fi
15 fi
16
17
18=== modified file 'src/w11tng/networkmanager.cpp'
19--- src/w11tng/networkmanager.cpp 2016-05-19 05:24:46 +0000
20+++ src/w11tng/networkmanager.cpp 2016-07-20 12:32:23 +0000
21@@ -166,6 +166,8 @@
22
23 if (mgmt_interface_)
24 mgmt_interface_.reset();
25+
26+ driver_cmd_iface_.clear();
27 }
28
29 void NetworkManager::SetDelegate(ac::NetworkManager::Delegate *delegate) {
30@@ -429,8 +431,8 @@
31 device->SetState(state);
32
33 if (state == ac::kDisconnected) {
34- if (ac::NetworkUtils::SendDriverPrivateCommand(mgmt_interface_->Ifname(),
35- BuildMiracastModeCommand(MiracastMode::kOff)) < 0)
36+ if (ac::NetworkUtils::SendDriverPrivateCommand(driver_cmd_iface_,
37+ BuildMiracastModeCommand(MiracastMode::kOff)) < 0)
38 AC_DEBUG("Failed to disable WiFi driver miracast mode (not supported?)");
39 else
40 AC_DEBUG("Disabled WiFi driver miracast mode");
41@@ -687,6 +689,8 @@
42 }
43
44 void NetworkManager::OnManagementInterfaceReady() {
45+ driver_cmd_iface_ = ac::Utils::GetEnvValue("AETHERCAST_DRIVER_CMD_IFACE",
46+ mgmt_interface_->Ifname());
47 }
48
49 std::string NetworkManager::BuildMiracastModeCommand(MiracastMode mode) {
50@@ -702,8 +706,8 @@
51 // Android WiFi drivers have a special mode build in when they should
52 // perform well for Miracast which we enable here. If the command is
53 // not available this is a no-op.
54- if (ac::NetworkUtils::SendDriverPrivateCommand(mgmt_interface_->Ifname(),
55- BuildMiracastModeCommand(MiracastMode::kSource)) < 0)
56+ if (ac::NetworkUtils::SendDriverPrivateCommand(driver_cmd_iface_,
57+ BuildMiracastModeCommand(MiracastMode::kSource)) < 0)
58 AC_WARNING("Failed to activate miracast mode of WiFi driver (not supported?)");
59 else
60 AC_DEBUG("Enabled WiFi driver miracast mode");
61
62=== modified file 'src/w11tng/networkmanager.h'
63--- src/w11tng/networkmanager.h 2016-05-19 05:24:46 +0000
64+++ src/w11tng/networkmanager.h 2016-07-20 12:32:23 +0000
65@@ -148,6 +148,7 @@
66 ac::NetworkManager::Delegate *delegate_;
67 std::shared_ptr<ManagerStub> manager_;
68 std::shared_ptr<InterfaceStub> mgmt_interface_;
69+ std::string driver_cmd_iface_;
70 std::shared_ptr<P2PDeviceStub> p2p_device_;
71 std::unordered_map<std::string,w11tng::NetworkDevice::Ptr> devices_;
72 NetworkDevice::Ptr current_device_;

Subscribers

People subscribed via source and target branches

to all changes: