Only prit CIDs the first time a device connects

This commit is contained in:
zvon 2020-06-11 18:26:42 +02:00
parent a69ba7787e
commit a8abe89cd1
2 changed files with 24 additions and 2 deletions

View File

@ -141,7 +141,6 @@ void Device::divert_buttons()
if(disconnected)
return;
uint16_t cid = irc.getControlInfo(i).control_id;
log_printf(DEBUG, "Available CID: 0x%x!", cid);
uint8_t flags = 0;
flags |= HIDPP20::IReprogControls::ChangeTemporaryDivert;
flags |= HIDPP20::IReprogControls::ChangeRawXYDivert;
@ -248,8 +247,30 @@ void Device::waitForReceiver()
this->start();
}
void Device::printCIDs() {
try
{
HIDPP20::IReprogControls irc = HIDPP20::IReprogControls::auto_version(hidpp_dev);
if(disconnected)
return;
int controlCount = irc.getControlCount();
for(int i = 0; i < controlCount; i++)
{
if(disconnected)
return;
uint16_t cid = irc.getControlInfo(i).control_id;
log_printf(DEBUG, "Available CID: 0x%x", cid);
}
}
catch(HIDPP20::UnsupportedFeature &e)
{
log_printf(DEBUG, "%s does not support Reprog controls, not diverting!", name.c_str());
}
}
void Device::start()
{
printCIDs();
configure();
try { listener->addEventHandler(std::make_unique<ButtonHandler>(this)); }
catch(HIDPP20::UnsupportedFeature &e) { }

View File

@ -58,6 +58,7 @@ namespace logid
EventListener* listener;
void divert_buttons();
void printCIDs();
void setSmartShift(HIDPP20::ISmartShift::SmartshiftStatus ops);
void setHiresScroll(uint8_t flags);
void setDPI(int dpi);
@ -158,4 +159,4 @@ namespace logid
}
#endif //LOGID_DEVICE_H
#endif //LOGID_DEVICE_H