Skip to content
RC3 edited this page Jun 26, 2013 · 12 revisions

What's the wfd command line?

Wi Fi Display test tool.

Connect two Android >= 4.2 devices through Wi-Fi network, not p2p.

 "usage"
 "   -l ip[:port]   listen on the specified port (create a source)"
 "   -c host[:port] connect to wifi source (create a sink)"
 "   -u uri         connect to an rtsp uri"

Must Need

  • Two Android >= 4.2 devices
  • Rooted!
  • 4.2.2 wfd source code.

In my opinion, nexus devices is better.

0. First time initialize

C:\> adb root
C:\> adb remount

C:\> adb shell ls -l /system/bin/wfd
-rwxr-xr-x root     shell       21868 2013-06-20 17:41 wfd

C:\> adb shell chown root:root /system/bin/wfd
C:\> adb shell chmod 7777 /system/bin/wfd

C:\> adb shell ls -l /system/bin/wfd
-rwsrwsrwt root     root        21868 2013-06-20 17:41 wfd

apply sticky bit to wfd.

1. Connect two Android >= 4.2 devices to Wi-Fi network.

2. Execute Source

Connect your device to PC via usb(adb).

$ adb shell netcfg
wlan0    UP    192.168.1.2/24  0x00001043 12:34:56:78:90:ab   <-- your device IP address.

$ adb shell wfd -l 192.168.1.2:20000

listen

3. Execute Sink

Connect another device to PC via usb(adb).

$ adb shell netcfg
wlan0    UP    192.168.1.3/24  0x00001043 ab:90:78:56:34:12   <-- your device IP address.

$ adb shell wfd -c 192.168.1.2:20000  <-- Source device IP Address != your device IP address

connect to source

Result

Source : Nexus 4(left img), Sink : Galaxy Nexus(right img), Screen : Vertical

,

Source : Nexus 4(left img), Sink : Galaxy Nexus(right img), Screen : Horizontal

,

More Detail in WFD

Source

static void createSource(const AString &addr, int32_t port);
static jint nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr);

These 2 functions so similar. WFD command is shortcut to invoke WifiDisplaySource. More, more detail describes "Wireless display connect" section.

Sink

WFD instantiated WifiDisplaySink class. Any other classes is not instantiating WifiDisplaySink class in android-4.2.2_r1.2 version.

    sp<WifiDisplaySink> sink = new WifiDisplaySink(session);