Skip to content

device_if behavior not symmetric with device_unless #1775

@jamesonquinn

Description

@jamesonquinn

KE v15.3.0
MacOS 14.6.1

Devices (copied from KEV/Devices):
[
{
"device_id": 4294969634,
"device_identifiers": { "is_keyboard": true },
"is_apple": true,
"is_built_in_keyboard": true,
"location_id": 176,
"manufacturer": "Apple",
"product": "Apple Internal Keyboard / Trackpad",
"transport": "FIFO"
},
{
"device_id": 4294969664,
"device_identifiers": { "is_pointing_device": true },
"is_apple": true,
"is_built_in_pointing_device": true,
"location_id": 176,
"manufacturer": "Apple",
"product": "Apple Internal Keyboard / Trackpad",
"transport": "FIFO"
},
{
"device_id": 4297095253,
"device_identifiers": {
"is_game_pad": true,
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 29700,
"vendor_id": 3141
},
"location_id": 1249280,
"manufacturer": "PCsensor",
"product": "FootSwitch3-F1.8",
"transport": "USB"
},
{
"device_id": 4297167274,
"device_identifiers": {
"is_keyboard": true,
"is_virtual_device": true,
"product_id": 591,
"vendor_id": 1452
},
"manufacturer": "pqrs.org",
"product": "Karabiner DriverKit VirtualHIDKeyboard 1.8.0",
"serial_number": "pqrs.org:Karabiner-DriverKit-VirtualHIDKeyboard"
},
{
"device_id": 4297095745,
"device_identifiers": {
"is_pointing_device": true,
"product_id": 52,
"vendor_id": 7247
},
"location_id": 1253376,
"manufacturer": "SIGMACHIP",
"product": "Usb Mouse",
"transport": "USB"
}
]

I want pressing "a" on the FootSwitch3-F1.8 to result in "x". So here's one attempt at a complex modification:

{
"description": "pedals",
"manipulators": [
{
"conditions": [
{
"identifiers": [{ "is_game_pad": true }],
"type": "device_if"
}
],
"from": {
"key_code": "a",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "x" }],
"type": "basic"
}
]
}

The above doesn't work; a=a on both internal keyboard and footswitch. However, if I change "device_if" to "device_unless", I do "successfully" get the reverse of the behavior I want; that is, a=x on internal keyboard, but a=a on footswitch.

Seems clear to me that this is some kind of bug.

(Note that using "is_game_pad" was not my first attempt; I was getting even-more-confusing behavior with "product_id" and "vendor_id". But this seems like a minimal, clear version of this bug.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions