Physical scroll wheel of the trackball (libinput, x11) won't work

I have a Kensington SlimBlade Trackball that has a sensor for scroll wheel.
I tried it in blender, it can’t neither zoom or scroll the view, actually it doesn’t have any response when I rotate the ball.

I used the libinput to capture the event, it should work. And the firefox doesn’t have any problem with it.
Any thing I could try to the blender preference or xorg’s configure ?

^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.008s      vert 15.00/1* horiz 0.00/0 (wheel)  
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.032s      vert 15.00/1* horiz 0.00/0 (wheel)  
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.056s      vert 15.00/1* horiz 0.00/0 (wheel)  
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.072s      vert 15.00/1* horiz 0.00/0 (wheel)  
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.096s      vert 15.00/1* horiz 0.00/0 (wheel)
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.120s      vert 15.00/1* horiz 0.00/0 (wheel)
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.152s      vert 15.00/1* horiz 0.00/0 (wheel)
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_AXIS     +2.200s      vert 15.00/1* horiz 0.00/0 (wheel)  
^[[B^[[B^[[B^[[B^[[B^[[B event14  POINTER_MOTION   +2.424s        0.00/ -0.32 ( +0.00/ -1.00)       
 event14  POINTER_MOTION   +2.432s        0.00/ -0.84 ( +0.00/ -1.00)                                                                                                               
 event14  POINTER_AXIS     +2.472s      vert 15.00/1* horiz 0.00/0 (wheel)

Here is my configure for X11.

Section "InputClass"
        Identifier      "Trackball"
        MatchVendor     "Kensington"
        Driver  "libinput"
        Option  "ButtonMapping" "1 2 0 0 0 0 0 3"
EndSection

try running xev in a terminal and see if the wheel reacts when used in the xev window (watch terminal output). You may need custom mapping.

Yes, it looks like when my cursor in this that X window, scrolling the ball won’t produce any new event.
I am not sure which custom mapping I need to do here, any document ?

Perhaps start at https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes.

Thank you,
but I use the evtest to check the event report by this trackball,
they are not different from a normal mouse, I wonder whether I need to touch keycode mapping here ?

I compared the response from trackball with the one from the mouse in xev, the only different is that scrolling the wheel in a mouse would become button 4 or button 5 it in.

vent: time 1619767856.884535, -------------- SYN_REPORT ------------
^[[B^[[B^[[B^[[B^[[B^[[BEvent: time 1619767856.956532, type 2 (EV_REL), code 8 (REL_WHEEL), value -1
Event: time 1619767856.956532, type 2 (EV_REL), code 11 (REL_WHEEL_HI_RES), value -120
Event: time 1619767856.956532, -------------- SYN_REPORT ------------
^[[B^[[B^[[B^[[B^[[B^[[BEvent: time 1619767857.036531, type 2 (EV_REL), code 8 (REL_WHEEL), value -1
Event: time 1619767857.036531, type 2 (EV_REL), code 11 (REL_WHEEL_HI_RES), value -120
Event: time 1619767857.036531, -------------- SYN_REPORT ------------
^[[B^[[B^[[B^[[B^[[B^[[BEvent: time 1619767857.660525, type 2 (EV_REL), code 8 (REL_WHEEL), value -1
Event: time 1619767857.660525, type 2 (EV_REL), code 11 (REL_WHEEL_HI_RES), value -120
Event: time 1619767857.660525, -------------- SYN_REPORT ------------

It’s the button assignments you need to look at. It’s been a long time since I needed to tweak, but rules matter.

Thank you, I figured out what the problem is
I trace the code the emulate_scroll_button_events() is the function generate the button pressing and releasing event from wheel scrolling. I work fine for both the trackball and the mouse.

From the document:
The ButtonMapping option adjusts the logical button mapping, it does not affect how a physical button is mapped to a logical button.
I should not disable the scroll up/down for there is not a physical button for it.

Section "InputClass"
        Identifier      "Trackball"
        MatchVendor     "Kensington"
        Driver  "libinput"
        Option  "ButtonMapping" "1 2 0 4 5 0 0 3"
EndSection