microsoft / NFC-Class-Extension-Driver

The NFC Class Extension driver implements all NFC device driver interfaces and standard NFC protocols and formats based on the NFC Forum NFC Controller Interface (NCI) Technical Specification
Other
57 stars 27 forks source link

update for NFC radio button not turned to ON when airplane button is turned from ON to OFF #37

Closed venkatesh-kv closed 6 years ago

venkatesh-kv commented 7 years ago

This commits solves the issue of NFC radio button not turned ON when airplane button is turned from ON to OFF. Following are the steps for issue reproduction

  1. install the nfc driver
  2. toggle the Airplane mode button to ON in "airplane mode settings"
  3. toggle the WIFI button to ON
  4. toggle the WIFI button to OFF
  5. toggle the bluetooth button to ON
  6. toggle the bluetooth button to OFF
  7. toggle the NFC radio button to ON
  8. toggle the NFC radio button to OFF
  9. toggle the Airplane mode button to OFF.

The expected result in step 9 is to turn ON the NFC radio button but that is NOT happening. But the other devices such as WIFI and Bluetooth is turned as ON.
The NFC radio button is maintained as OFF.

this is because when the airplane mode is toggled to OFF the previous value of " NfpPowerOffPolicyOverride" is retained and this causes the driver not to update the radio state.

Also, the IRP is returned with the status as "STATUS_INVALID_DEVICE_STATE" and in trace log we see the message "We are already in the requested power state"

to overcome the issue, we shall update the value of "NfpPowerOffPolicyOverride" depending on the input parameter of "RadioState->MediaRadioOn" as this ensures that previous value of "NfpPowerOffPolicyOverride" is not retained

cwize1 commented 6 years ago

This fix does not produce the correct behavior in all circumstances. I have opened a bug on myself to fix this issue.