Print version number of device 1 on each raw dev.
Only works on HID++ >=2.0 so far. Also solves a race condition where the wrong response can be sent to a request.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "Root.h"
|
||||
|
||||
using namespace logid::backend::hidpp20;
|
||||
|
||||
Root::Root(Device* dev) : Feature(dev, ID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
feature_info Root::getFeature(uint16_t feature_id)
|
||||
{
|
||||
feature_info info;
|
||||
std::vector<uint8_t> params(2);
|
||||
params[0] = feature_id & 0xff;
|
||||
params[1] = (feature_id >> 8) & 0xff;
|
||||
|
||||
auto response = this->callFunction(Function::Ping, params);
|
||||
|
||||
info.feature_id = response[0];
|
||||
info.hidden = response[1] & FeatureFlag::Hidden;
|
||||
info.obsolete = response[1] & FeatureFlag::Obsolete;
|
||||
info.internal = response[1] & FeatureFlag::Internal;
|
||||
|
||||
return info;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef LOGID_BACKEND_HIDPP20_FEATURE_ROOT_H
|
||||
#define LOGID_BACKEND_HIDPP20_FEATURE_ROOT_H
|
||||
|
||||
#include "../Feature.h"
|
||||
#include "../feature_defs.h"
|
||||
|
||||
namespace logid {
|
||||
namespace backend {
|
||||
namespace hidpp20
|
||||
{
|
||||
class Root : public Feature
|
||||
{
|
||||
public:
|
||||
static const uint16_t ID = FeatureID::ROOT;
|
||||
virtual uint16_t getID() { return ID; }
|
||||
|
||||
enum Function : uint8_t
|
||||
{
|
||||
GetFeature = 0,
|
||||
Ping = 1
|
||||
};
|
||||
|
||||
Root(Device* device);
|
||||
|
||||
feature_info getFeature (uint16_t feature_id);
|
||||
void ping();
|
||||
private:
|
||||
enum FeatureFlag : uint8_t
|
||||
{
|
||||
Obsolete = 1<<7,
|
||||
Hidden = 1<<6,
|
||||
Internal = 1<<5
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif //LOGID_BACKEND_HIDPP20_FEATURE_ROOT_H
|
||||
Reference in New Issue
Block a user