|
@@ -203,6 +203,94 @@ def test_wifi_display(dev):
|
|
|
dev[1].request("SET wifi_display 0")
|
|
|
dev[2].request("SET wifi_display 0")
|
|
|
|
|
|
+def test_wifi_display_r2(dev):
|
|
|
+ """Wi-Fi Display extensions to P2P with R2 subelems"""
|
|
|
+ wfd_devinfo = "00411c440028"
|
|
|
+ dev[0].request("SET wifi_display 1")
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 0 0006" + wfd_devinfo)
|
|
|
+
|
|
|
+ # Associated BSSID
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 1 0006020304050607")
|
|
|
+ # Coupled Sink
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 6 000700000000000000")
|
|
|
+ # Session Info
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 9 0000")
|
|
|
+ # WFD Extended Capability
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 7 00020000")
|
|
|
+ # WFD Content Protection
|
|
|
+ prot = "0001" + "00"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 5 " + prot)
|
|
|
+ # WFD Video Formats
|
|
|
+ video = "0015" + "010203040506070809101112131415161718192021"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 3 " + video)
|
|
|
+ # WFD 3D Video Formats
|
|
|
+ video_3d = "0011" + "0102030405060708091011121314151617"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 4 " + video_3d)
|
|
|
+ # WFD Audio Formats
|
|
|
+ audio = "000f" + "010203040506070809101112131415"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 2 " + audio)
|
|
|
+ # MAC Info
|
|
|
+ mac_info = "0006" + "112233445566"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 10 " + mac_info)
|
|
|
+ # R2 Device Info
|
|
|
+ r2_dev_info = "0006" + "aabbccddeeff"
|
|
|
+ dev[0].request("WFD_SUBELEM_SET 11 " + r2_dev_info)
|
|
|
+
|
|
|
+ elems = dev[0].request("WFD_SUBELEM_GET all")
|
|
|
+ if wfd_devinfo not in elems:
|
|
|
+ raise Exception("Could not fetch back configured subelements")
|
|
|
+
|
|
|
+ wfd_devinfo2 = "00001c440028"
|
|
|
+ dev[1].request("SET wifi_display 1")
|
|
|
+ dev[1].request("WFD_SUBELEM_SET 0 0006" + wfd_devinfo2)
|
|
|
+ if wfd_devinfo2 not in dev[1].request("WFD_SUBELEM_GET 0"):
|
|
|
+ raise Exception("Could not fetch back configured subelement")
|
|
|
+
|
|
|
+ dev[0].p2p_listen()
|
|
|
+ dev[1].p2p_find(social=True)
|
|
|
+ ev = dev[1].wait_global_event(["P2P-DEVICE-FOUND"], timeout=5)
|
|
|
+ if ev is None:
|
|
|
+ raise Exception("Device discovery timed out")
|
|
|
+ if "wfd_dev_info=0x" + wfd_devinfo not in ev:
|
|
|
+ raise Exception("Wi-Fi Display Info not in P2P-DEVICE-FOUND event")
|
|
|
+ if "new=1" not in ev:
|
|
|
+ raise Exception("new=1 flag missing from P2P-DEVICE-FOUND event")
|
|
|
+
|
|
|
+ pin = dev[0].wps_read_pin()
|
|
|
+ dev[0].p2p_go_neg_auth(dev[1].p2p_dev_addr(), pin, 'display')
|
|
|
+ res1 = dev[1].p2p_go_neg_init(dev[0].p2p_dev_addr(), pin, 'enter',
|
|
|
+ timeout=20, go_intent=15, freq=2437)
|
|
|
+ res2 = dev[0].p2p_go_neg_auth_result()
|
|
|
+
|
|
|
+ bss = dev[0].get_bss("p2p_dev_addr=" + dev[1].p2p_dev_addr())
|
|
|
+ if bss['bssid'] != dev[1].p2p_interface_addr():
|
|
|
+ raise Exception("Unexpected BSSID in the BSS entry for the GO")
|
|
|
+ if wfd_devinfo2 not in bss['wfd_subelems']:
|
|
|
+ raise Exception("Could not see wfd_subelems in GO's BSS entry")
|
|
|
+ peer = dev[0].get_peer(dev[1].p2p_dev_addr())
|
|
|
+ if wfd_devinfo2 not in peer['wfd_subelems']:
|
|
|
+ raise Exception("Could not see wfd_subelems in GO's peer entry")
|
|
|
+ peer = dev[1].get_peer(dev[0].p2p_dev_addr())
|
|
|
+ if wfd_devinfo not in peer['wfd_subelems']:
|
|
|
+ raise Exception("Could not see wfd_subelems in client's peer entry")
|
|
|
+ if r2_dev_info not in peer['wfd_subelems']:
|
|
|
+ raise Exception("Could not see r2_dev_info in client's peer entry")
|
|
|
+
|
|
|
+ elems = dev[0].request("WFD_SUBELEM_GET all")
|
|
|
+ if "OK" not in dev[0].request("WFD_SUBELEM_SET all " + elems):
|
|
|
+ raise Exception("WFD_SUBELEM_SET all failed")
|
|
|
+ if dev[0].request("WFD_SUBELEM_GET all") != elems:
|
|
|
+ raise Exception("Mismatch in WFS_SUBELEM_SET/GET all")
|
|
|
+ test = "00000600411c440028"
|
|
|
+ if "OK" not in dev[0].request("WFD_SUBELEM_SET all " + test):
|
|
|
+ raise Exception("WFD_SUBELEM_SET all failed")
|
|
|
+ if dev[0].request("WFD_SUBELEM_GET all") != test:
|
|
|
+ raise Exception("Mismatch in WFS_SUBELEM_SET/GET all")
|
|
|
+
|
|
|
+ dev[0].request("SET wifi_display 0")
|
|
|
+ dev[1].request("SET wifi_display 0")
|
|
|
+ dev[2].request("SET wifi_display 0")
|
|
|
+
|
|
|
def enable_wifi_display(dev):
|
|
|
dev.request("SET wifi_display 1")
|
|
|
dev.request("WFD_SUBELEM_SET 0 000600411c440028")
|