qmk/qmk_firmware

[Bug] Mouse key MS_BTN1 ~ MS_BTN8 are not working when PS/2 trackpoint enabled with RP2040 MCU

Closed

#24,599 opened on Nov 14, 2024

View on GitHub
 (10 comments) (0 reactions) (0 assignees)C (20,368 stars) (43,867 forks)batch import
bughelp wanted

Description

Describe the Bug

Hi, I'm trying to create a keyboard with trackpoint module for myself. I've got the PS/2 trackpoint module and use Raspberry PI PICO (RP2040 MCU) to test my QMK firmware. I've enabled the PS/2 mouse and vendor driver in keyboard.json and the trackpoint works fine. Then I tried to update my keymap to support sending mouse button click(left/middle/right button click) from my keyboard, but I find it is not working. The tricky thing is only MS_BTN1 ~ MS_BTN8 are not working, others works fine(e.g. the wheel scroll keycode MS_WHLU and MS_WHLD). I tried to disable the PS/2 module and driver then the result is MS_BTN1 ~ MS_BTN3 are working again. I can send mouse click from my keyboard. is this a conflict between RP2040 ps2 vendor driver and mouse key feature? How can I resolve this and let my trackpoint and mouse keycode work together? Or maybe @gamelaster can give some suggestions from ps2_vendor.c side?

I used the latest master branch qmk_firmware repository. Below are my related files (my keyboard name is nomouse): rule.mk:

# Bootloader selection
BOOTLOADER = rp2040
MOUSEKEY_ENABLE = yes
BOARD = GENERIC_RP_RP2040
CONSOLE_ENABLE = yes

nomouse.h:

#pragma once
#include "quantum.h"


keyboard.json:

{
    "manufacturer": "Tachikoma",
    "keyboard_name": "Nomouse",
    "maintainer": "Tachikoma",
    "bootloader": "rp2040",
    "diode_direction": "COL2ROW",
    "features": {
        "bootmagic": true,
        "command": true,
        "console": true,
        "extrakey": true,
        "mousekey": true,
        "nkro": true
    },
    "matrix_pins": {
        "cols": [ "GP2", "GP3", "GP4", "GP5", "GP6", "GP7", "GP8", "GP9", "GP10", "GP11", "GP12", "GP13", "GP14", "GP15" ],
        "rows": [ "GP16", "GP17", "GP18", "GP19", "GP20"]
    },
    "processor": "RP2040",
    "url": "",
    "usb": {
        "device_version": "1.0.0",
        "pid": "0x0000",
        "vid": "0xFEED"
    },
    "ps2": {
        "clock_pin": "GP1",
        "data_pin": "GP0",
        "driver": "vendor",
        "enabled": true,
        "mouse_enabled": true
    },
    "mouse_key": {
        "enabled":true
    },
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"matrix": [0, 0], "x": 0, "y": 0},
                {"matrix": [0, 1], "x": 1, "y": 0},
                {"matrix": [0, 2], "x": 2, "y": 0},
                {"matrix": [0, 3], "x": 3, "y": 0},
                {"matrix": [0, 4], "x": 4, "y": 0},
                {"matrix": [0, 5], "x": 5, "y": 0},
                {"matrix": [0, 6], "x": 6, "y": 0},
                {"matrix": [0, 7], "x": 7, "y": 0},
                {"matrix": [0, 8], "x": 8, "y": 0},
                {"matrix": [0, 9], "x": 9, "y": 0},
                {"matrix": [0, 10], "x": 10, "y": 0},
                {"matrix": [0, 11], "x": 11, "y": 0},
                {"matrix": [0, 12], "x": 12, "y": 0},
                {"matrix": [0, 13], "x": 13, "y": 0, "w": 2},

                {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
                {"matrix": [1, 1], "x": 1.5, "y": 1},
                {"matrix": [1, 2], "x": 2.5, "y": 1},
                {"matrix": [1, 3], "x": 3.5, "y": 1},
                {"matrix": [1, 4], "x": 4.5, "y": 1},
                {"matrix": [1, 5], "x": 5.5, "y": 1},
                {"matrix": [1, 6], "x": 6.5, "y": 1},
                {"matrix": [1, 7], "x": 7.5, "y": 1},
                {"matrix": [1, 8], "x": 8.5, "y": 1},
                {"matrix": [1, 9], "x": 9.5, "y": 1},
                {"matrix": [1, 10], "x": 10.5, "y": 1},
                {"matrix": [1, 11], "x": 11.5, "y": 1},
                {"matrix": [1, 12], "x": 12.5, "y": 1},
                {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5},

                {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
                {"matrix": [2, 2], "x": 1.75, "y": 2},
                {"matrix": [2, 3], "x": 2.75, "y": 2},
                {"matrix": [2, 4], "x": 3.75, "y": 2},
                {"matrix": [2, 5], "x": 4.75, "y": 2},
                {"matrix": [2, 6], "x": 5.75, "y": 2},
                {"matrix": [2, 7], "x": 6.75, "y": 2},
                {"matrix": [2, 8], "x": 7.75, "y": 2},
                {"matrix": [2, 9], "x": 8.75, "y": 2},
                {"matrix": [2, 10], "x": 9.75, "y": 2},
                {"matrix": [2, 11], "x": 10.75, "y": 2},
                {"matrix": [2, 12], "x": 11.75, "y": 2},
                {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25},

                {"matrix": [3, 1], "x": 0, "y": 3, "w": 2.25},
                {"matrix": [3, 2], "x": 2.25, "y": 3},
                {"matrix": [3, 3], "x": 3.25, "y": 3},
                {"matrix": [3, 4], "x": 4.25, "y": 3},
                {"matrix": [3, 5], "x": 5.25, "y": 3},
                {"matrix": [3, 6], "x": 6.25, "y": 3},
                {"matrix": [3, 7], "x": 7.25, "y": 3},
                {"matrix": [3, 8], "x": 8.25, "y": 3},
                {"matrix": [3, 9], "x": 9.25, "y": 3},
                {"matrix": [3, 10], "x": 10.25, "y": 3},
                {"matrix": [3, 11], "x": 11.25, "y": 3},
                {"matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
                {"matrix": [3, 13], "x": 14, "y": 3, "w": 1},

                {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25},
                {"matrix": [4, 2], "x": 1.25, "y": 4, "w": 1.5},
                {"matrix": [4, 3], "x": 2.75, "y": 4, "w": 1.25},
                {"matrix": [4, 5], "x": 4, "y": 4, "w": 2},
                {"matrix": [4, 8], "x": 8, "y": 4, "w": 2},
                {"matrix": [4, 10], "x": 10, "y": 4, "w": 1.5},
                {"matrix": [4, 11], "x": 11.5, "y": 4, "w": 1.5},
                {"matrix": [4, 12], "x": 13, "y": 4, "w": 1.5},
                {"matrix": [4, 13], "x": 14, "y": 4, "w": 1}
            ]
        }
    }
}

config.h:

#pragma once

keymap.c:

// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

    [0] = LAYOUT( /* 0: qwerty */
        KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSLS,
        // KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSPC,
        // this row for mouse key testing
        KC_1,  MS_BTN1,    MS_BTN2,    MS_BTN3,    MS_WHLU,    MS_WHLD,    MS_WHLL,    MS_WHLR,    KC_MS_BTN2,    MS_BTN1,    KC_P,    KC_LBRC, KC_RBRC, KC_BSPC,
        KC_LCTL,          KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT,
                 KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, KC_HOME,
        KC_LCTL,          KC_LGUI, KC_LALT,          KC_SPC,                    KC_ENT,           KC_RALT, KC_RGUI, KC_RCTL, KC_END
    ),
};

My config refers to these docs: https://docs.qmk.fm/features/mouse_keys https://docs.qmk.fm/features/ps2_mouse#rp2040-pio-version

Keyboard Used

No response

Link to product page (if applicable)

No response

Operating System

No response

qmk doctor Output

No response

Is AutoHotKey / Karabiner installed

  • AutoHotKey (Windows)
  • Karabiner (macOS)

Other keyboard-related software installed

No response

Additional Context

No response

Contributor guide