Fix undetected CIDs
This commit is contained in:
parent
0f60c3896c
commit
a2718d9023
|
@ -79,20 +79,23 @@ ReprogControls::ControlInfo ReprogControls::getControlInfo(uint8_t index)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReprogControls::ControlInfo ReprogControls::getControlIdInfo(uint16_t cid)
|
void ReprogControls::initCidMap()
|
||||||
{
|
{
|
||||||
if(!_cids_initialized) {
|
|
||||||
std::unique_lock<std::mutex> lock(_cids_populating);
|
std::unique_lock<std::mutex> lock(_cids_populating);
|
||||||
if(!_cids_initialized) {
|
if(_cids_initialized)
|
||||||
|
return;
|
||||||
uint8_t controls = getControlCount();
|
uint8_t controls = getControlCount();
|
||||||
for(uint8_t i = 0; i < controls; i++) {
|
for(uint8_t i = 0; i < controls; i++) {
|
||||||
auto info = getControlInfo(i);
|
auto info = getControlInfo(i);
|
||||||
_cids.emplace(info.controlID, info);
|
_cids.emplace(info.controlID, info);
|
||||||
}
|
}
|
||||||
_cids_populating.unlock();
|
|
||||||
_cids_initialized = true;
|
_cids_initialized = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
ReprogControls::ControlInfo ReprogControls::getControlIdInfo(uint16_t cid)
|
||||||
|
{
|
||||||
|
if(!_cids_initialized)
|
||||||
|
initCidMap();
|
||||||
|
|
||||||
auto it = _cids.find(cid);
|
auto it = _cids.find(cid);
|
||||||
if(it == _cids.end())
|
if(it == _cids.end())
|
||||||
|
|
|
@ -95,6 +95,8 @@ namespace hidpp20
|
||||||
|
|
||||||
virtual ControlInfo getControlIdInfo(uint16_t cid);
|
virtual ControlInfo getControlIdInfo(uint16_t cid);
|
||||||
|
|
||||||
|
virtual void initCidMap();
|
||||||
|
|
||||||
// Onlu controlId and flags will be set
|
// Onlu controlId and flags will be set
|
||||||
virtual ControlInfo getControlReporting(uint16_t cid);
|
virtual ControlInfo getControlReporting(uint16_t cid);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ using namespace logid::actions;
|
||||||
RemapButton::RemapButton(Device *dev): DeviceFeature(dev), _config (dev),
|
RemapButton::RemapButton(Device *dev): DeviceFeature(dev), _config (dev),
|
||||||
_reprog_controls (hidpp20::ReprogControls::autoVersion(&dev->hidpp20()))
|
_reprog_controls (hidpp20::ReprogControls::autoVersion(&dev->hidpp20()))
|
||||||
{
|
{
|
||||||
|
_reprog_controls->initCidMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
RemapButton::~RemapButton()
|
RemapButton::~RemapButton()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user