diff --git a/src/logid/Device.cpp b/src/logid/Device.cpp index 4005b18..35a4095 100644 --- a/src/logid/Device.cpp +++ b/src/logid/Device.cpp @@ -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(this)); } catch(HIDPP20::UnsupportedFeature &e) { } diff --git a/src/logid/Device.h b/src/logid/Device.h index 2b3da82..1d37820 100644 --- a/src/logid/Device.h +++ b/src/logid/Device.h @@ -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 \ No newline at end of file +#endif //LOGID_DEVICE_H