[Bug] Nothing happens when I try to manipulate the mouse report in `pointing_device_task_user()`
In the keymap for my Ploopy Classic Trackball, I have a custom key that is intended to make scrolling go horizontally rather than vertically. However, when I try to set mouse_report.h and mouse_report.v, in pointing_device_task_user(), it appears to have no effect and my mouse continues to scroll vertically after pressing the key.
Describe the Bug
Nothing seems to happen when I try to set mouse_report.h and mouse_report.v in pointing_device_task_user().
System Information
Keyboard: Ploopy Classic Trackball
Revision (if applicable): rev. 1.005
Operating system: EndeavourOS Sway Edition
qmk doctor output:
Ψ QMK Doctor is checking your environment.
Ψ CLI version: 1.1.0
Ψ QMK home: /home/anomalocaris/qmk_firmware
Ψ Detected Linux.
Ψ Git branch: personal-keymap
Ψ Repo version: 0.14.23
Ψ All dependencies are installed.
Ψ Found arm-none-eabi-gcc version 12.1.0
Ψ Found avr-gcc version 8.3.0
Ψ Found avrdude version 7.0
Ψ Found dfu-util version 0.11
Ψ Found dfu-programmer version 0.7.2
Ψ Submodules are up to date.
Ψ QMK is ready to go
Any keyboard related software installed?
- [ ] AutoHotKey (Windows)
- [ ] Karabiner (macOS)
- [ ] Other:
Additional Context
Here is a link to my keymap. The code that implements the custom keycode, HORI_SCROLL is located at lines 70-91. pointing_device_task_user(), where I attempt to manipulate the mouse report is located at lines 83-91.
Are you returning said mouse report?
And could you post the code that you're using?
Yes, I am returning the mouse report.
Here's my pointing_device_task_user():
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
if (horizontal_scroll) {
int8_t h = mouse_report.h;
mouse_report.h = -mouse_report.v;
mouse_report.v = h;
}
return mouse_report;
}
horizontal_scroll is a boolean that gets flipped when I press a custom keycode, HORI_SCROLL. Just in case it's important, here's its implementation:
static bool horizontal_scroll = false;
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case HORI_SCROLL:
if (record->event.pressed) {
horizontal_scroll ^= 1;
}
return false;
}
return true;
}
process_record_keymap isn't supported by default, so there is that.
But as for pointing_device_task_user, that does appear to be getting called. And the code looks like it should work.
Are you using PLOOPY_SAFE_RANGE rather than SAFE_RANGE for your keycode enum?
Sorry about that and sorry for taking so long to respond. I completely forgot that I use some custom stuff I defined in userspace:
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VRSN:
if (record->event.pressed) {
send_version();
}
return false;
case FLASH:
if (record->event.pressed) {
send_flash_command();
}
return false;
}
return process_record_keymap(keycode, record);
}
For my keycode enum, I have this in my keymap:
enum custom_keycodes_keymap {
HORI_SCROLL = KEYMAP_SAFE_RANGE,
};
And this in userspace:
enum custom_keycodes_user {
#if defined(KEYBOARD_ergodox_ez)
VRSN = EZ_SAFE_RANGE,
#elif defined(KEYBOARD_ploopyco_trackball_rev1_005)
VRSN = PLOOPY_SAFE_RANGE,
#else
VRSN = SAFE_RANGE,
#endif
FLASH, // Type qmk command for flashing firmware
KEYMAP_SAFE_RANGE,
};
Here are links to my keymap and userspace in case I forgot anything else that is pertinent:
- https://github.com/Anomalocaridid/qmk_firmware/tree/personal-keymap/keyboards/ploopyco/trackball/keymaps/anomalocaridid
- https://github.com/Anomalocaridid/qmk_firmware/tree/personal-keymap/users/anomalocaridid
Rebasing onto the newest commits did not seem to fix anything.