Only prit CIDs the first time a device connects
This commit is contained in:
		@@ -141,7 +141,6 @@ void Device::divert_buttons()
 | 
				
			|||||||
            if(disconnected)
 | 
					            if(disconnected)
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            uint16_t cid = irc.getControlInfo(i).control_id;
 | 
					            uint16_t cid = irc.getControlInfo(i).control_id;
 | 
				
			||||||
            log_printf(DEBUG, "Available CID: 0x%x!", cid);
 | 
					 | 
				
			||||||
            uint8_t flags = 0;
 | 
					            uint8_t flags = 0;
 | 
				
			||||||
            flags |= HIDPP20::IReprogControls::ChangeTemporaryDivert;
 | 
					            flags |= HIDPP20::IReprogControls::ChangeTemporaryDivert;
 | 
				
			||||||
            flags |= HIDPP20::IReprogControls::ChangeRawXYDivert;
 | 
					            flags |= HIDPP20::IReprogControls::ChangeRawXYDivert;
 | 
				
			||||||
@@ -248,8 +247,30 @@ void Device::waitForReceiver()
 | 
				
			|||||||
    this->start();
 | 
					    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()
 | 
					void Device::start()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    printCIDs();
 | 
				
			||||||
    configure();
 | 
					    configure();
 | 
				
			||||||
    try { listener->addEventHandler(std::make_unique<ButtonHandler>(this)); }
 | 
					    try { listener->addEventHandler(std::make_unique<ButtonHandler>(this)); }
 | 
				
			||||||
    catch(HIDPP20::UnsupportedFeature &e) { }
 | 
					    catch(HIDPP20::UnsupportedFeature &e) { }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,6 +58,7 @@ namespace logid
 | 
				
			|||||||
        EventListener* listener;
 | 
					        EventListener* listener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void divert_buttons();
 | 
					        void divert_buttons();
 | 
				
			||||||
 | 
					        void printCIDs();
 | 
				
			||||||
        void setSmartShift(HIDPP20::ISmartShift::SmartshiftStatus ops);
 | 
					        void setSmartShift(HIDPP20::ISmartShift::SmartshiftStatus ops);
 | 
				
			||||||
        void setHiresScroll(uint8_t flags);
 | 
					        void setHiresScroll(uint8_t flags);
 | 
				
			||||||
        void setDPI(int dpi);
 | 
					        void setDPI(int dpi);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user