WLAN On / Off

      Hello,

      think you can use functions of ndis.h/ntddndis.h, e.g. IOCTL_NDIS_UNBIND_ADAPTER, ... .

      On board is an executable called ndisconfig which wrapps this functionality enter "ndisconfig -h" for details.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      Hello,
      like suggested, the functionality can be implemented for the efusA9X as follows (add error handling):

      #include "ndis.h"
      #include "WINIOCTL.h"

      void BindWifiAdapter(bool enableBinding)
      {
      TCHAR adapterNames[] = _T("SDIO87871\0"); // ‘\0’ to finish multi sz

      HANDLE hDev = CreateFile(_T("NDS0:"), GENERIC_READ | GENERIC_WRITE,
      FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

      if (hDev != INVALID_HANDLE_VALUE)
      {
      BOOL result = DeviceIoControl(hDev,
      enableBinding ? IOCTL_NDIS_BIND_ADAPTER : IOCTL_NDIS_UNBIND_ADAPTER,
      adapterNames, sizeof(adapterNames), NULL, 0, NULL, NULL);

      CloseHandle(hDev);
      }
      }

      void SwitchWifiAdapter(bool enablePower)
      {
      SetDevicePower(_T("SDIO87871"), POWER_NAME,
      enablePower ? PwrDeviceUnspecified : D4);
      }


      Best regards,
      Steffen

      Post was edited 1 time, last by “Steffen” ().

      Hello,

      I’m worried about some entries in the debug log arising while switching WiFi power and bindings. I’m not sure whether these entries indicate serious errors or could be ignored. Can you give your estimation, please?

      I’ve performed the tests with ndisconfig.exe. The registry setting for HKLM\Drivers\BuiltIn\Ethman\Popup\Popup is word:0.
      The log entries are listed related to the performed transition. Some of these entries occur not on every transition.
      All possible transitions in this area have been tested. Maybe you can advise which transitions are not appropriate und should not be used.

      Transition from D0, Bound to D4, Bound
      Command: ndisconfig power set SDIO87871 D4
      Resulting log entries: None

      Transition from D4, Bound to D0, Bound
      Command: ndisconfig power set SDIO87871 D0
      Resulting log entries:
      T Wj<-75><-23><-127><-103><-123><-91><-79><-107><-111><-127><-47><-67><-127><-51><-107><-47><-127><-91><-71><-103><-55><-123><-127><-75><-67><-111><-107><-127>=% <-79><-127><-107><-55><-55><-67><-55><-127><-59><-59><-39><-35>5)<-1>

      Transition from D0, Unbound to D4, Unbound
      Command: ndisconfig power set SDIO87871 D4
      Resulting log entries: None

      Transition from D4, Unbound to D0, Unbound
      Command: ndisconfig power set SDIO87871 D0
      Resulting log entries:
      H<-22>U<-107><-91><2>:<-107><-47>]<-91><-55><-107><-79><-107><-51><-51>%<-71><-103><-67><-127><-103><-123><-91><-79><-107><-111><-127><-63><-31><-47><-27><-63>5)<-1>
      !NWUI: RefreshAvailableNetwork failed 0x32
      !NWUI: RefreshWiFiInterface failed 0x32
      !NWUI: GetWirelessInfo failed 0x32
      !NWUI: RefreshAvailableNetwork failed 0x32
      !NWUI: RefreshWiFiInterface failed 0x32
      !NWUI: GetWirelessInfo failed 0x32
      or
      *<-118><-118><-54>e5<-11>5u<-91><-47><-115><-95>Y<-67><-79><-47><-23><-127><-59><-59><-43><-63><-75>Y<-127><-55><-107><-99>Y<-123><-79><-11><-63><-31><-47><-31><-55><-123><-59><-55>5)<-127><-87><-87><-87><-87><-87><-127><5>I5<-127>
      =I§<-127><-31><-63><-63>5!<-23><-127><-87><-87><-87><-87><-87><-87><-87><-127>5)<-1>

      Transition from D0, Bound to D0, Unbound
      Command: ndisconfig dapter unbind SDIO87871
      Resulting log entries:
      *<-118><-118><-54>e5<-11>5u<-91><-47><-115><-95>Y<-67><-79><-47><-23><-127><-59><-59><-43><-63><-75>Y<-127><-55><-107><-99>Y<-123><-79><-11><-63><-31><-47><-31><-55><-123><-59><-55>5)<-127><-87><-87><-87><-87><-87><-127><5>I5<-127>
      =I§<-127><-31><-63><-63>5!<-23><-127><-87><-87><-87><-87><-87><-87><-87><-127>5)<-1>
      [WLANAPI] Failed to reference the client context from the handle, error 6
      or
      [WLANAPI] Stopped waiting for notification because server returns error (0, 1818)

      Transition from D0, Unbound to D0, Bound
      Command: ndisconfig dapter bind SDIO87871
      Resulting log entries:
      *<-118><-118><-54>e5<-11>5u<-91><-47><-115><-95>Y<-67><-79><-47><-23><-127><-59><-59><-43><-63><-75>Y<-127><-55><-107><-99>Y<-123><-79><-11><-63><-31><-47><-31><-55><-123><-59><-55>5)<-127><-87><-87><-87><-87><-87><-127><5>I5<-127>
      =I§<-127><-31><-63><-63>5!<-23><-127><-87><-87><-87><-87><-87><-87><-87><-127>5)<-1>
      !NWUI: GetWirelessInfo failed 0x490

      Transition from D4, Bound to D4, Unbound
      Command: ndisconfig dapter unbind SDIO87871
      Resulting log entries:
      *<-118><-118><-54>e5<-11>5u<-91><-47><-115><-95>Y<-67><-79><-47><-23><-127><-59><-59><-43><-63><-75>Y<-127><-55><-107><-99>Y<-123><-79><-11><-63><-31><-47><-31><-55><-123><-59><-55>5)<-127><-87><-87><-87><-87><-87><-127><5>I5<-127>
      =I§<-127><-31><-63><-63>5!<-23><-127><-87><-87><-87><-87><-87><-87><-87><-127>5)<-1>
      [WLANAPI] Stopped waiting for notification because server returns error (0, 1818)
      or
      [WLANAPI] Failed to reference the client context from the handle, error 6

      Transition from D4, Unbound to D4, Bound
      Command: ndisconfig dapter bind SDIO87871
      Resulting log entries:
      H<-22>U<-107><-91><2>:<-107><-47>]<-91><-55><-107><-79><-107><-51><-51>%<-71><-103><-67><-127><-103><-123><-91><-79><-107><-111><-127><-63><-31><-47><-27><-63>5)<-1>
      FatMsm: failed to initialize adapter, error 31
      !NWUI: GetWirelessInfo failed 0x490
      !NWUI: GetWirelessInfo failed 0x490

      Sometimes not all of the protocols (NDISUIO, TCPIP6 , TCPIP) are bound to the SDIO87871 after this call (NDISUIO every time).


      Best regards,
      Steffen