diff --git a/src/logid/backend/hidpp20/features/ReprogControls.cpp b/src/logid/backend/hidpp20/features/ReprogControls.cpp index 1bf0fcc..ce10bb0 100644 --- a/src/logid/backend/hidpp20/features/ReprogControls.cpp +++ b/src/logid/backend/hidpp20/features/ReprogControls.cpp @@ -92,6 +92,12 @@ void ReprogControls::initCidMap() _cids_initialized = true; } +const std::map& + ReprogControls::getControls() const +{ + return _cids; +} + ReprogControls::ControlInfo ReprogControls::getControlIdInfo(uint16_t cid) { if(!_cids_initialized) diff --git a/src/logid/backend/hidpp20/features/ReprogControls.h b/src/logid/backend/hidpp20/features/ReprogControls.h index a3d342c..a62b464 100644 --- a/src/logid/backend/hidpp20/features/ReprogControls.h +++ b/src/logid/backend/hidpp20/features/ReprogControls.h @@ -97,6 +97,8 @@ namespace hidpp20 virtual void initCidMap(); + const std::map& getControls() const; + // Onlu controlId and flags will be set virtual ControlInfo getControlReporting(uint16_t cid); diff --git a/src/logid/backend/raw/RawDevice.cpp b/src/logid/backend/raw/RawDevice.cpp index e4f919a..c7d5ce5 100644 --- a/src/logid/backend/raw/RawDevice.cpp +++ b/src/logid/backend/raw/RawDevice.cpp @@ -311,7 +311,7 @@ std::vector RawDevice::_respondToReport int RawDevice::_sendReport(const std::vector& report) { std::lock_guard lock(_dev_io); - if(logid::global_loglevel == LogLevel::RAWREPORT) { + if(logid::global_loglevel <= LogLevel::RAWREPORT) { printf("[RAWREPORT] %s OUT: ", _path.c_str()); for(auto &i : report) printf("%02x ", i); @@ -389,7 +389,7 @@ int RawDevice::_readReport(std::vector &report, if(0 == ret) throw backend::TimeoutError(); - if(logid::global_loglevel == LogLevel::RAWREPORT) { + if(logid::global_loglevel <= LogLevel::RAWREPORT) { printf("[RAWREPORT] %s IN: ", _path.c_str()); for(auto &i : report) printf("%02x ", i); diff --git a/src/logid/features/RemapButton.cpp b/src/logid/features/RemapButton.cpp index 3078084..9f8f813 100644 --- a/src/logid/features/RemapButton.cpp +++ b/src/logid/features/RemapButton.cpp @@ -33,6 +33,25 @@ RemapButton::RemapButton(Device *dev): DeviceFeature(dev), _config (dev), _reprog_controls (hidpp20::ReprogControls::autoVersion(&dev->hidpp20())) { _reprog_controls->initCidMap(); + + if(global_loglevel <= DEBUG) { + #define FLAG(x) control.second.flags & hidpp20::ReprogControls::x ? \ + "YES" : "" + #define ADDITIONAL_FLAG(x) control.second.additionalFlags & \ + hidpp20::ReprogControls::x ? "YES" : "" + + // Print CIDs, originally by zv0n + logPrintf(DEBUG, "%s:%d remappable buttons:", + dev->hidpp20().devicePath().c_str(), + dev->hidpp20().deviceIndex()); + logPrintf(DEBUG, "CID | reprog? | fn key? | mouse key? | " + "gesture support?"); + for(const auto & control : _reprog_controls->getControls()) + logPrintf(DEBUG, "0x%02x | %-7s | %-7s | %-10s | %s", + control.first, FLAG(TemporaryDivertable), FLAG(FKey), + FLAG(MouseButton), ADDITIONAL_FLAG(RawXY)); + #undef FLAG + } } RemapButton::~RemapButton()