]>
Commit | Line | Data |
---|---|---|
8426a147 JM |
1 | # Wi-Fi Display test cases |
2 | # Copyright (c) 2013, Jouni Malinen <j@w1.fi> | |
3 | # | |
4 | # This software may be distributed under the terms of the BSD license. | |
5 | # See README for more details. | |
6 | ||
7 | import logging | |
8 | logger = logging.getLogger() | |
9 | import time | |
10 | import threading | |
11 | import Queue | |
12 | ||
13 | import hwsim_utils | |
14 | import utils | |
15 | ||
16 | def test_wifi_display(dev): | |
82fa9b62 | 17 | """Wi-Fi Display extensions to P2P""" |
8426a147 JM |
18 | wfd_devinfo = "00011c440028" |
19 | dev[0].request("SET wifi_display 1") | |
20 | dev[0].request("WFD_SUBELEM_SET 0 0006" + wfd_devinfo) | |
21 | if wfd_devinfo not in dev[0].request("WFD_SUBELEM_GET 0"): | |
22 | raise Exception("Could not fetch back configured subelement") | |
23 | ||
24 | wfd_devinfo2 = "00001c440028" | |
25 | dev[1].request("SET wifi_display 1") | |
26 | dev[1].request("WFD_SUBELEM_SET 0 0006" + wfd_devinfo2) | |
27 | if wfd_devinfo2 not in dev[1].request("WFD_SUBELEM_GET 0"): | |
28 | raise Exception("Could not fetch back configured subelement") | |
29 | ||
30 | dev[0].p2p_listen() | |
31 | dev[1].p2p_find(social=True) | |
32 | ev = dev[1].wait_event(["P2P-DEVICE-FOUND"], timeout=5) | |
33 | if ev is None: | |
34 | raise Exception("Device discovery timed out") | |
35 | if "wfd_dev_info=0x" + wfd_devinfo not in ev: | |
36 | raise Exception("Wi-Fi Display Info not in P2P-DEVICE-FOUND event") | |
37 | ||
38 | pin = dev[0].wps_read_pin() | |
39 | dev[0].p2p_go_neg_auth(dev[1].p2p_dev_addr(), pin, 'display') | |
40 | res1 = dev[1].p2p_go_neg_init(dev[0].p2p_dev_addr(), pin, 'enter', timeout=20, go_intent=15) | |
41 | res2 = dev[0].p2p_go_neg_auth_result() | |
42 | ||
43 | bss = dev[0].get_bss("p2p_dev_addr=" + dev[1].p2p_dev_addr()) | |
44 | if bss['bssid'] != dev[1].p2p_interface_addr(): | |
45 | raise Exception("Unexpected BSSID in the BSS entry for the GO") | |
46 | if wfd_devinfo2 not in bss['wfd_subelems']: | |
47 | raise Exception("Could not see wfd_subelems in GO's BSS entry") | |
48 | peer = dev[0].get_peer(dev[1].p2p_dev_addr()) | |
49 | if wfd_devinfo2 not in peer['wfd_subelems']: | |
50 | raise Exception("Could not see wfd_subelems in GO's peer entry") | |
51 | peer = dev[1].get_peer(dev[0].p2p_dev_addr()) | |
52 | if wfd_devinfo not in peer['wfd_subelems']: | |
53 | raise Exception("Could not see wfd_subelems in client's peer entry") | |
54 | ||
55 | wfd_devinfo3 = "00001c440028" | |
56 | dev[2].request("SET wifi_display 1") | |
57 | dev[2].request("WFD_SUBELEM_SET 0 0006" + wfd_devinfo3) | |
58 | dev[2].p2p_find(social=True) | |
59 | ev = dev[2].wait_event(["P2P-DEVICE-FOUND"], timeout=5) | |
60 | if ev is None: | |
61 | raise Exception("Device discovery timed out") | |
62 | if dev[1].p2p_dev_addr() not in ev: | |
63 | ev = dev[2].wait_event(["P2P-DEVICE-FOUND"], timeout=5) | |
64 | if ev is None: | |
65 | raise Exception("Device discovery timed out") | |
66 | if dev[1].p2p_dev_addr() not in ev: | |
67 | raise Exception("Could not discover GO") | |
68 | if "wfd_dev_info=0x" + wfd_devinfo2 not in ev: | |
69 | raise Exception("Wi-Fi Display Info not in P2P-DEVICE-FOUND event") | |
70 | bss = dev[2].get_bss("p2p_dev_addr=" + dev[1].p2p_dev_addr()) | |
71 | if bss['bssid'] != dev[1].p2p_interface_addr(): | |
72 | raise Exception("Unexpected BSSID in the BSS entry for the GO") | |
73 | if wfd_devinfo2 not in bss['wfd_subelems']: | |
74 | raise Exception("Could not see wfd_subelems in GO's BSS entry") | |
75 | peer = dev[2].get_peer(dev[1].p2p_dev_addr()) | |
76 | if wfd_devinfo2 not in peer['wfd_subelems']: | |
77 | raise Exception("Could not see wfd_subelems in GO's peer entry") |