Generic Devices: Philips Footcontrol ACC2330

The Philips Footcontrol ACC2330 is a foot switch assembly featuring four pedal switches. Like its sibling products ACC2310 and ACC2320, which only have three pedals but are very similar otherwise, it is meant to be used together with the Philips SpeechControl software to aid in the transcription of audio recordings where the pedals control the playback (pause, continue, fast forward, rewind etc).

It connects to the host computer through a fixed USB cable, about 3m long with a Type-A plug at the end, and presents itself as a USB HID device with Vendor ID 0x911 and Product ID 0x91a (the latter number is 2330 in decimal). The report it sends when pedal switches are pressed and released consists of three bytes of which only the first one (= byte 0) is of interest. Each switch has its own bit (0x01, 02, 04 and 08) which gets set on press and unset on release.

The switches can be combined (used concurrently) at will, with one notable and curious exception affecting the interaction of the middle and the top pedal switches: The middle switch takes precedence over the top switch, i.e. changes of the top switch are not reported while the middle switch is pressed, and if the top switch is held down when the middle switch is pressed and released, a release event for the top switch is sent along with the press event for the middle switch, and an press event for the top switch is sent along with the release event for the middle switch. Only those two switches behave that way, i.e. the top switch and the middle switch can be combined with all the other switches without any such effects.

Better Touch Tool ≥4.063 supports the ACC2330 through its "General Devices" feature with the following code:

var LastReportDataHex;
function analyzeDeviceInput(targetDevice, reportID, reportDataHex)
{
    const last_rdata_hex =
        (LastReportDataHex ||= {})[targetDevice +'.'+ reportID] ||= 
            '0'.repeat(reportDataHex.length);
    
    const last_r = buffer.Buffer.from(last_rdata_hex, 'hex');
    const this_r = buffer.Buffer.from(reportDataHex, 'hex');

    LastReportDataHex[targetDevice +'.'+ reportID] = this_r.toString('hex');

    const buttons = [
        [ 'right', 0, 0x01 ],
        [ 'middle', 0, 0x02 ],
        [ 'left', 0, 0x04 ],
        [ 'top', 0, 0x08 ]
    ];

    for (const [b_name, b_byte, b_mask] of buttons) {      
        const last_b_state = (last_r.readUInt8(b_byte) & b_mask);
        const this_b_state = (this_r.readUInt8(b_byte) & b_mask);

        if (last_b_state ^ this_b_state) {
            const b_event = this_b_state ? b_name : b_name + '_up';
            log('deviceTrigger: '+ b_event);
            bttTriggerDeviceTrigger(targetDevice, b_event);
        }
    }
}

I am including the code here so that everybody can review it without having to install the preset file. Feel free to copy, adapt and improve it for your own generic device projects!

Preset file: Philips Footcontol ACC2330.2023-03-09.bttpreset

Nice! Thanks for sharing!
By the way, you can also copy the complete "device analyzer" you set up - either by moving it to its own preset and then exporting the preset, or by cmd+c and cmd+v'ing the json here.