With the help of the generic devices tool, I have mapped the basic functionality of the Logitech Craft keyboard, with the rotating dial. I am also using it blissfully free of the Crown Overlay, on a Mac.
The Craft has two rotation modes, a ratcheted click step one and a superfine smooth one.
The click step one was easy to map and get usable triggers for, but the smooth one is more involved.
For the coarse step, it has Index 6 which has "01" for clockwise Crown movement and "ff" for counter-clockwise rotation.
But for the fine movement reporting it is index 18+19 and it has six rotation speeds being reported for each direction! "ff", "fe", "fd", "fc", etc., and 01-(maybe?)07 for the other direction.
When I try to use those indexes, I am not getting buttery smooth scrolling. What is happening is that Index 18 has the speed range in multiple values, and 19 has the events, and I don't know how to capture it.
<code
function analyzeDeviceInput(targetDevice, reportID, reportDataHex) {
let reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');
// the values you see above are in hex format. To read such a byte
// use readUInt8(index).
//Touch events
if(reportBuffer.readUInt8(8) === 0x03 && reportBuffer.readUInt8(9) === 0x01) {
log('doubletouch');
bttTriggerDeviceTrigger(targetDevice, 'DoubleTouch')
}
if(reportBuffer.readUInt8(8) === 0x01) {
log('touch');
bttTriggerDeviceTrigger(targetDevice, 'Touch');
}else if(reportBuffer.readUInt8(8) === 0x03) {
log('touchrelease');
bttTriggerDeviceTrigger(targetDevice, 'TouchRelease');
}
//Press events
if(reportBuffer.readUInt8(10) === 0x01) {
log('press');
bttTriggerDeviceTrigger(targetDevice, 'Press');
}else if(reportBuffer.readUInt8(10) === 0x03) {
log('pressholdstatic');
bttTriggerDeviceTrigger(targetDevice, 'PressHoldStatic');
}else if(reportBuffer.readUInt8(10) === 0x05) {
log('pressrelease');
bttTriggerDeviceTrigger(targetDevice, 'PressRelease');
}
//StepEvents
if(reportBuffer.readUInt8(8) === 2 && reportBuffer.readUInt8(6) === 0x01 && reportBuffer.readUInt8(10) === 0x00) {
log('stepcw');
bttTriggerDeviceTrigger(targetDevice, 'StepCW');
}else if(reportBuffer.readUInt8(8) === 2 && reportBuffer.readUInt8(6) === 0xff && reportBuffer.readUInt8(10) === 0x00) {
log('stepccw');
bttTriggerDeviceTrigger(targetDevice, 'StepCCW');
}
if(reportBuffer.readUInt8(8) === 2 && reportBuffer.readUInt8(6) === 0x01 && reportBuffer.readUInt8(10) === 0x04) {
log('pressstepcw');
bttTriggerDeviceTrigger(targetDevice, 'PressStepCW');
}else if(reportBuffer.readUInt8(8) === 2 && reportBuffer.readUInt8(6) === 0xff && reportBuffer.readUInt8(10) === 0x04) {
log('pressstepccw');
bttTriggerDeviceTrigger(targetDevice, 'PressStepCCW');
}