Browse Source
Merge pull request #12801 from german77/vibration-fix
service: hid: Don't try to vibrate if device isn't initialized
pull/15/merge
liamwhite
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
9 additions and
0 deletions
-
src/hid_core/resource_manager.cpp
-
src/hid_core/resources/vibration/vibration_base.cpp
-
src/hid_core/resources/vibration/vibration_base.h
|
|
|
@ -373,6 +373,10 @@ Result ResourceManager::SendVibrationValue(u64 aruid, |
|
|
|
device = GetNSVibrationDevice(handle); |
|
|
|
} |
|
|
|
if (device != nullptr) { |
|
|
|
// Prevent sending vibrations to an inactive vibration handle
|
|
|
|
if (!device->IsActive()) { |
|
|
|
return ResultSuccess; |
|
|
|
} |
|
|
|
result = device->SendVibrationValue(value); |
|
|
|
} |
|
|
|
return result; |
|
|
|
|
|
|
|
@ -23,6 +23,10 @@ Result NpadVibrationBase::Deactivate() { |
|
|
|
return ResultSuccess; |
|
|
|
} |
|
|
|
|
|
|
|
bool NpadVibrationBase::IsActive() const { |
|
|
|
return ref_counter > 0; |
|
|
|
} |
|
|
|
|
|
|
|
bool NpadVibrationBase::IsVibrationMounted() const { |
|
|
|
return is_mounted; |
|
|
|
} |
|
|
|
|
|
|
|
@ -21,6 +21,7 @@ public: |
|
|
|
virtual Result Activate(); |
|
|
|
virtual Result Deactivate(); |
|
|
|
|
|
|
|
bool IsActive() const; |
|
|
|
bool IsVibrationMounted() const; |
|
|
|
|
|
|
|
protected: |
|
|
|
|