uConsole Trackball as Scrolling wheel [temporary] Solution

It seems DevTerm folks already have this kind of solutions back then.

However, DevTerm had a proper middle mouse button, the uConsole doesn’t. So after a little digging into libinput, here is the solution for uConsole, temporarily.

Step-by-Step guide
  1. Install the package xinput

    sudo apt install xinput
    
  2. Edit the file .xsessionrc in your home directory (it should already have this file there, if not, create one), and add folling contents listed below.

    ~/.xsessionrc

    # Enable scrolling emulation by using middle mouse button and moving the wheel.
    xinput --set-prop 'ClockworkPI uConsole Mouse' 'libinput Scroll Method Enabled' 0 0 1
    # Enable middle mouse button emulation by hold the left and right mouse button at the same time.
    xinput --set-prop 'ClockworkPI uConsole Mouse' 'libinput Middle Emulation Enabled' 1
    # Optional: Enable natural scrolling for touchscreen-like operating on mouse whell.
    xinput --set-prop 'ClockworkPI uConsole Mouse' 'libinput Natural Scrolling Enabled' 1
    
  3. Log out, and log back in to apply changes.

Then, you can hold the left and right mouse button at the same time, and scrolling with the trackball.

You can also use the scroll wheel by pressing down the trackball and rub against the trackball at the same time to get the scrolling work, but I wouldn’t recommend this because this may bad for the durability of the trackball itself.

The downside for this is the middle mouse button no longer trigger the middle mouse button function any more. If you need the clickable trackball as middle mouse button itself to work then this solution may not suitable for you. This should not affect external connected input device though, so your USB or bluetooth mouse’s middle button should function as normal.

P.S.: I hope someone can modify the keyboard firmware itself to add those functions directly in the hardware itself, just like what DevTerm folks did back then.

I had to use keyd GitHub - rvaiya/keyd: A key remapping daemon for linux. on an aliexpress cheap laptop to get the mouse buttons correctly mapped.

While I only used a small subset of its capabilities, it might be a better solution since you can config modifiers and different behavior based on hold time, etc for different results, and it is DE agnostic, fast, and it is a service. It even has different behavior per program (experimental)

1 Like

It’s simple to make trackball mode controlled by Fn key status rather than the middle click status.

in trackball.ino, change:

const auto mode = dv->state->moveTrackball();

to:

const auto mode = dv->Keyboard_state.fn_on == 0 ? TrackballMode::Mouse : TrackballMode::Wheel;
6 Likes

If anybody is interested, I have the trackball code updated as in the previous post and a compiled binary that can be flashed using the flash program ( uconsole_keyboard_flash.tar.gz).

You can find the binary here: https://github.com/dsegel/uConsole/blob/master/Code/uconsole_keyboard/uconsole_keyboard.ino.generic_stm32f103r8.bin

The repo with the modified code is here: https://github.com/dsegel/uConsole

It works and make Fn+Trackball scroll.

2 Likes

oh cool where is that trackball.ino file?

Someone once asked but the question is deleted so I didn’t post a link. The trackball.ino is part of the firmware for uConsole keyboard. It can be found at uConsole Github repo. You have to recompile and flash the firmware to apply those changes.

1 Like

Awesome thank you! I’ll read up on flashing the keyboard

awesome fix

included to uconsole repo now

uconsole_keyboard_flash.tar.gz updated

Here’s how you can flash the firmware on uConsole(A06 or CM4) or a PC running Ubuntu 22.04:

  1. Download the uconsole_keyboard_flash.tar.gz file.
  2. Extract the contents of the archive: tar zxvf uconsole_keyboard_flash.tar.gz.
  3. Install the required package using the following command: sudo apt install -y dfu-util.
  4. Navigate to the extracted directory: cd uconsole_keyboard_flash.
  5. Execute the flash script with root privileges: sudo ./flash.sh.
  6. If everything goes well, you will see a progress bar indicating the flashing process.
  7. If any issues occur or the keyboard loses control (which is unlikely), simply reboot uConsole to resolve it.
  8. Rest assured that this flash program will not brick your keyboard.
6 Likes

Thank you so SO much! It works! Not having a scroll will was xtremely annoying!