Generic Devices: Report repeated events even if monitored bytes don't change

Generic Devices are a great addition to the feature set. I used to use MacDial to monitor events of my SurfaceDial knob (a neat piece of hardware). From my experience hacking MacDial, I know that if I turn the knob right, it reports the same state for every "click" (a rotation of "n" degrees). Unfortunately, BTT only reports a single event, no matter how far right I turn the knob. Could you make that optional? That would make rotary knobs like the SurfaceDial actually useful for macOS.

thanks so much

ah yes I will add a function that you can call to make it recognize again. Will upload a version that includes this later!

In 4.005 you can now just call
bttGetNextEvenWithoutChange(targetDevice, reportID)
from your analyzer function, then it will get the next report even if there hasn't been a change in the data itself.

Works like a charm -- very nice, and thanks so much.

As soon as you get around to Support sending "Key Repeat" events for keyboard shortcut action, it will turn my SurfaceDial into a nice shuttle for Final Cut Pro :slight_smile:

Nice, would be great if you could share your script!

The key repeat thing is on my TODO list and I should get to it soon.

Sure, very simple, though:

function analyzeDeviceInput(targetDevice, reportID, reportDataHex) {
    let reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');
    if(reportBuffer.readUInt8(1) === 0x03) {
        bttTriggerDeviceTrigger(targetDevice, 'button');
    } else if(reportBuffer.readUInt8(2) === 0x01) {
        bttTriggerDeviceTrigger(targetDevice, 'right');
    } else if(reportBuffer.readUInt8(2) === 0xff) {
        bttTriggerDeviceTrigger(targetDevice, 'left');
    bttGetNextEvenWithoutChange(targetDevice, reportID)

The Dial actually has some other nice features, like haptic feedback and configurable sensitivity. I might try using the executeBTTCommand feature to enable those at some point.

1 Like

Thanks for sharing! Things like the Surface Dial are exactly the type of device I thought about when adding this generic device functionality. It's pretty nice being able to revive a small device with a few lines of code.

1 Like