diff --git a/Nintroller/Nintroller.cs b/Nintroller/Nintroller.cs index 76c42b3..86c38bc 100644 --- a/Nintroller/Nintroller.cs +++ b/Nintroller/Nintroller.cs @@ -698,9 +698,9 @@ private void ParseReport(byte[] report) break; case ReadReportType.Extension_B: + _readType = ReadReportType.Unknown; if (report.Length < 6) { - _readType = ReadReportType.Unknown; Log("Report length not long enough for Extension_B"); return; } @@ -1142,7 +1142,7 @@ private void ParseReport(byte[] report) case InputReport.BtnsIRExt: case InputReport.BtnsAccIRExt: case InputReport.ExtOnly: - if (_state != null) + if (_state != null && _currentType != ControllerType.Unknown) { _state.Update(report); var arg = new NintrollerStateEventArgs(_currentType, _state, BatteryLevel); @@ -1156,7 +1156,9 @@ private void ParseReport(byte[] report) Debug.WriteLine("State Update Exception: " + ex.ToString()); } } - else if (_statusType != StatusType.DiscoverExtension) + else if (_statusType != StatusType.DiscoverExtension && + _readType != ReadReportType.Extension_A && + _readType != ReadReportType.Extension_B) { Log("State is null! Requesting status"); _currentType = ControllerType.Unknown; @@ -1389,6 +1391,9 @@ public void StopReading() { _reading = false; _connected = false; + _ackType = AcknowledgementType.NA; + _statusType = StatusType.Unknown; + _readType = ReadReportType.Unknown; } #endregion diff --git a/WiitarThing/Components/DeviceControl.xaml.cs b/WiitarThing/Components/DeviceControl.xaml.cs index 1c1d85b..4881ebf 100644 --- a/WiitarThing/Components/DeviceControl.xaml.cs +++ b/WiitarThing/Components/DeviceControl.xaml.cs @@ -309,7 +309,7 @@ void device_ExtensionChange(object sender, NintrollerExtensionEventArgs e) Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() => { - UpdateIcon(DeviceType); + RefreshState(); } )); }