govert / WiFiDirectLegacyAPDemo

Copy of the Windows sample that allows 'soft AP' support on Windows 10 through the WiFi Direct interfaces
49 stars 9 forks source link

Device connected, status=Error #3

Open bagaweb opened 2 years ago

bagaweb commented 2 years ago

Hello and thanks for the tool. Anyway I cannot connect my smartphone, it stucks on obtaining IP and console says "Device connected, status=Error". Any idea how to make it work?

govert commented 2 years ago

I tried it now - I get a connection and an IP address (from an Android phone). However, it does show "Connected, no Internet" because there is nothing set up to route a internet traffic through that connection. I'm not sure what mechanism assigns the ad-hoc IP addresses on Windows. But I do get an IP address on the phone ( some 192.168.137.x) and similar on the Windows machine.

I don't use this tool myself, so I don't have much experience in when it works or doesn't.

bagaweb commented 2 years ago

Alright thanks I can just confirm it is not working after trying with another Android phone.

govert commented 2 years ago

Can you show the output of running netsh wlan show wirelesscapabilities ? I get:

PS C:\> netsh wlan show wirelesscapabilities

Wireless System Capabilities
----------------------------
    Number of antennas connected to the 802.11 radio (value not available)

    Max number of channels the device can operate on, simultaneously (value not available)

    Co-existence Support                        : Unknown

Wireless Device Capabilities
----------------------------

Interface name: Wi-Fi

    WDI Version (Windows)                       : 0.1.1.10

    WDI Version (IHV)                           : 0.1.1.9

    Firmware Version                            : C3.C

    Station                                     : Supported

    Soft AP                                     : Not supported

    Network monitor mode                        : Not supported

    Wi-Fi Direct Device                         : Supported

    Wi-Fi Direct GO                             : Supported

    Wi-Fi Direct Client                         : Supported

    Protected Management Frames                 : Supported

    DOT11k neighbor report                      : Supported

    ANQP Service Information Discovery          : Supported

    Action Frame                                : Supported

    Diversity Antenna                           : Supported

    IBSS                                        : Not Supported

    Promiscuous Mode                            : Not Supported

    P2P Device Discovery                        : Supported

    P2P Service Name Discovery                  : Supported

    P2P Service Info Discovery                  : Not Supported

    P2P Background Discovery                    : Supported

    P2P GO on 5 GHz                             : Supported

    ASP 2.0 Service Name Discovery              : Not Supported

    ASP 2.0 Service Information Discovery       : Not Supported

    IP Docking Capable                          : Not Supported

    FIPS                                        : Supported

    Instant Connect                             : Supported

    Dx Standby NLO                              : Supported

    Extended Channel Switch Announcement        : Supported

    Function Level Reset                        : Supported

    Platform Level Reset                        : Supported

    Bus Level Reset                             : Not Supported

    MAC Randomization                           : Supported

    Fast Transition                             : Supported

    MU-MIMO                                     : Supported

    Miracast Sink                               : Supported

    BSS Transition (802.11v)                    : Supported

    IHV Extensibility Module Configured         : Supported

    SAE Authentication                          : Supported

    SAE Hash-to-Element Authentication          : Not Supported

    WPA3 SUITE-B Authentication                 : Not Supported

    WPA3 SUITE-B FIPS Mode                      : Not Supported

    OWE Authentication                          : Supported

    FTM as Initiator                            : Not Supported

    MBO Support                                 : Supported

    Number of Tx Spatial Streams                : 2

    Number of Rx Spatial Streams                : 2

    Number of Concurrent Channels Supported     : 0

    P2P GO ports count                          : 1

    P2P Clients Port Count                      : 1

    P2P Max Mobile AP Clients                   : 10

    Max ANQP Service Advertisements Supported   : 0

    Co-existence Support                        : Wi-Fi performance is maintained
bagaweb commented 2 years ago

Here we go, looks quite similar:

`Funzionalità wireless del sistema

Numero di antenne connesse alla radio 802.11 (valore non disponibile)

Numero massimo di canali su cui può operare il dispositivo contemporaneamente (valore non disponibile)

Supporto per coesistenza                        : sconosciuto

Funzionalità dispositivo wireless

Nome interfaccia: Wi-Fi

Versione WDI (Windows)                       : 0.1.1.8

Versione WDI (IHV)                           : 0.1.1.12

Versione firmware                            : 34.77

Stazione                                     : supportata

Punto di accesso soft                                     : non supportato

Modalità Network Monitor                        : non supportata

Dispositivo Wi-Fi Direct                         : supportato

Proprietario gruppo Wi-Fi Direct                             : supportato

Client Wi-Fi Direct                         : supportato

Frame di gestione protetti                 : Supportato

Rapporto router adiacenti DOT11k                      : Supportato

Individuazione informazioni servizio ANQP          : Supportato

Frame azione                                : Supportato

Antenna diversità                           : Supportato

IBSS                                        : Non supportato

Modalità promiscua                             : Non supportato

Individuazione dispositivi P2P                        : Supportato

Individuazione nomi di servizio P2P                  : Supportato

Individuazione informazioni servizio P2P                  : Non supportato

Individuazione in background P2P                    : Supportato

Proprietario gruppo P2P su 5 GHz                             : Supportato

Individuazione nomi di servizio ASP 2.0              : Non supportato

Individuazione informazioni servizio ASP 2.0       : Non supportato

Supporto per ancoraggio IP                          : Non supportato

FIPS                                        : Supportato

Connessione istantanea                             : Supportato

NLO standby Dx                              : Supportato

ECSA (Extended Channel Switch Announcement)        : Supportato

Reimpostazione a livello di funzione                        : Supportato

Reimpostazione livello piattaforma                        : Supportato

Reimpostazione a livello di bus                        : Supportato

Assegnazione casuale di indirizzi MAC                           : Supportato

Transizione rapida                             : Supportato

MU-MIMO                                     : Supportato

Sink Miracast                               : Supportato

Transizione BSS (802.11v): Supportato

Modulo estendibilità IHV configurato         : Supportato

Autenticazione SAE                          : Supportato

FTM come iniziatore:  Non supportato

Supporto MBO                                 : Supportato

Numero di flussi spaziali Tx                : 2

Numero di flussi spaziali Rx                : 2

Numero di canali simultanei supportati     : 0

Conteggio porte proprietario gruppo P2P                          : 1

Conteggio porte client P2P                      : 1

Numero massimo di client punto di accesso mobili P2P                   : 8

Numero massimo di annunci di servizio ANQP supportati   : 0

Supporto per coesistenza                         : prestazioni Wi-Fi mantenute`
govert commented 2 years ago

Yes - all the Wi-Fi Direct features seem to be supported.

Did you put in a long enough passphrase? It must be at least 8 chars long, else the error is weird.

Can you show the output from running the utility? I get:

PS C:\Users\GovertvanDrimmelen\Downloads> .\WiFiDirectLegacyAPDemo.exe

>?

Wi-Fi Direct Legacy AP Demo Usage:
----------------------------------
start             : Start the legacy AP to accept connections
stop              : Stop the legacy AP
ssid <ssid>       : Configure the SSID before starting the legacy AP
pass <passphrase> : Configure the passphrase before starting the legacy AP
autoaccept <0|1>  : Configure the legacy AP to accept connections (default) or prompt the user
quit|exit         : Exit

>ssid TestDirectAP

Setting SSID to TestDirectAP

>autoaccept 1

Setting AutoAccept to 1 (input was 1)

>pass Password

Setting Passphrase to Password

>start

Starting soft AP...

Connection Listener is ready
Soft AP started!
Peers can connect to: TestDirectAP
Passphrase: Password

>
Connection Requested...

Peer connected: 192.168.137.9
bagaweb commented 2 years ago

I tried your very same settings but same error as before. Phone stucks at obtaining IP. Here's the output:

`Wi-Fi Direct Legacy AP Demo Usage:

start : Start the legacy AP to accept connections stop : Stop the legacy AP ssid : Configure the SSID before starting the legacy AP pass : Configure the passphrase before starting the legacy AP autoaccept <0|1> : Configure the legacy AP to accept connections (default) or prompt the user quit|exit : Exit

ssid TestDirectAP

Setting SSID to TestDirectAP

autoaccept 1

Setting AutoAccept to 1 (input was 1)

pass Password

Setting Passphrase to Password

start

Starting soft AP...

Connection Listener is ready Soft AP started! Peers can connect to: TestDirectAP Passphrase: Password

Connection Requested...

Device connected, status=Error`

Thansk for your help.

govert commented 2 years ago

I'm afraid I don't know how to get a better error message.

It's basically when this code is called: https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifidirect.wifidirectdevice.fromidasync?view=winrt-22000#Windows_Devices_WiFiDirect_WiFiDirectDevice_FromIdAsync_System_String_

But I don't know enough about the new Windows API stuff to get a better error message, or why it would fail here.

The only other path I can think of (if you're not a programmer and keen to dig into the code and the API) is to look for an app that has this functionality. I remember there were some (not free) when I initially looked at this last year.

bagaweb commented 2 years ago

Maybe there's something wrong with my Wi-Fi adapter, it's an Intel Wi-Fi 6 AX200. I might give a try to the app Connectify Hotspot and see what happens.

smvicente commented 2 years ago

I think this problem might be due to this: https://www.intel.com/content/www/us/en/support/articles/000029083/wireless.html

If so, you can solve it by connecting to an existing WiFi AP before creating the hotspot...

jptrol commented 2 months ago

Hello ,

With the WiFiDirectLegacyAPDemo app I just cannot figure out how the connection can be established . I was happy in the old days up to windows 8.1 with its hosted network and the netsh wlan commands . You created your network with the AP , started it and it included a DHCP server that responded to clients , offering them suitable IP adresses.

Now with windows 10 and the WDI driver , I just try to compile WiFiDirectLegacyAPDemo with VS 2022 and launch it . It starts the AP but the poor clients try in vain to get an IP address in return to their DHCP discover requests. Is the DHCP process still supposed to be used here ? I can't see any mention of it in the code. And we are only "imitating" a Wifi Direct process here , so ...