USB Input Device Remixes

User avatar

10 Mar 2019, 23:17

I thought it might be fun to remix USB signals from existing input devices into "new" ones.

I used Hasu’s great TMK USB to USB converter hardware ( I also adapted his tmk_keyboard firmware by adding another converter directory and one tiny, opt-in edit to the core protocol Makefile. Previously implemented sets of converters work by configuring “keymaps” that map one keyboard matrix to another, virtual one. That didn’t really make sense for my project, so I left them out.

These remixes should also run on other hardware with an Arduino USB Host Shield — provided you can find one and get it working.

To install, download or clone my branch of the repository from github (, review the root README file, change into the converter/keymapless_usb_usb directory, and follow the instructions in that file.

Please note that a few varieties of mice (for example, "Verbatim" mice) may not work well with some of these remixes. (see "boot protocols", Remix 5)

Remix 1: Ergo Scroll-Ball

Most mice and mouse-like input devices sold today dedicate a control for fast vertical scrolling. Controls for fast horizontal scrolling are less common. When provided, they can be awkward or unpleasant. Some mice feature separate wheels for each axis that are difficult to operate simultaneously. Others feature a single scroll wheel that’s oriented vertically, but also clumsily performs horizontal scrolling by nudging left and right.

I find it easiest to have a single control and a single method to scroll both axes. Such devices exist, but tend to exhibit other characteristics I dislike (wireless, no right button, too small, etc.)

So, I remixed an old trackball into an Ergonomic Scroll-Ball.

I recommend operating a conventional mouse or track ball with your favored hand, and the Ergo Scroll-Ball with your unfavored hand, on the opposite side of your keyboard. I thought it would be weird, but it’s actually great. You can easily move the mouse pointer and scroll bi-directionally, at the same time.

Another bonus: with a little programming, it’s easy to adjust sensitivity and choose whether to use “natural” scrolling.

I wasn’t sure what to do with the Scrollball’s buttons, so I mapped its left button to button 3 and the right one to button 4, with the effect that both now launch links into new tabs on my web browser.

To use, open a terminal shell and type

Code: Select all

make REMIX=scrollball dfu
Remix 2: Arrow Keys Game Mouse/Trackball

Some desktop computer-based video games optionally accept mouse and trackball input. But the interface is often limited. Now, we can build our own. This remix
  1. Maps mouse motions to the corresponding arrow cluster keyboard keys. (They could just as easily map to W-A-S-D, etc.)
  2. Maps the primary mouse button to the space bar.
To install, pull up a terminal shell and type

Code: Select all

make REMIX=arrowkeys dfu
Remix 3: Mouse/Trackball Naptime

Animals sleep. We sleep. Your computer sleeps. Why shouldn’t your mouse pointer go to sleep?

Initially, this remix will just relay mouse cursor repositioning and button events from the host device to your computer. However, if you leave your mouse alone for a while, its pointer will go to sleep. Subsequent inputs will "wake" it.

For reasons we won't get into just yet, this remix will not relay scroll inputs.

To use, pull up a terminal shell and type

Code: Select all

make REMIX=naptime dfu
Remix 4: MIDI Controller Macro Pad

MIDI controllers take up a lot of desk space, so it’d be nice to get some use out of them when you aren't playing music. This remix will convert them into macro pads. Potentially resulting in even more cross-context confusion over the meaning of the word "keyboard".

I mapped the white (music-keyboard) keys to numbered (typing-keyboard) function keys, and the black ones to “application” keys; things like a web browser key, an email key, etc.

I'm not personally a fan of unlegended keys. But I understand MIDI controller keys are typically ABS plastic, so in principle they should accept dye-subbing…

To install, pull up a terminal shell and type

Code: Select all

make REMIX=midimacropad dfu
Note that black application keys won't work on Macs, without hacking.

Remix 5: Very Expensive Knob

Thanks to the Scroll-ball Remix, you might not need your old, vertical axis-only scrolling mouse any more. What can you do with it?

Provided it's one of the supported mice (see below), you could turn it into a very expensive volume knob!

If all goes well, vertical scroll wheel actuations can be translated to a finite number of Volume Up and Volume Down media key presses. Click the left mouse button to mute and unmute.

This remix requires us to confront some fundamental challenges with USB mouse protocols.

All of our previous remixes have attempted to exploit HID Boot Protocol. Boot Protocol is a pared-down set of messages supported by most (but not all!) mice. The idea is to let you interact with your device before its drivers have loaded, when your computer first starts up.

Boot protocol remains useful after booting, because it's so well-standardized that it's easy to support.

Unfortunately, there's a catch. Boot protocol seems to have been standardized before mouse-scrolling was widely deployed. So, for the most part, scrolling support was implemented in separate, report protocols. Sadly, mouse report protocols are poorly-standardized and numerous.

The Linux evdev mouse drivers ( ... nput/mouse) could be adapted to the USB host shield library used in tmk_keyboard to provide broad support for all these protocols. But it would be a lot of work, and I'm not even sure that it would all fit onto the TMK converter hardware.

So instead, I took a piecemeal approach. I implemented just enough custom support for my input devices to work with this remix. These are:
  • Microsoft Classic Intellimouse (2018)
  • Kensington (Sunplus) 0x0002 Mouse
  • Dell Optical Mouse
  • Targus notebook combo trackball-mouse (see Remix 6 for more details)
To use this remix, start a terminal shell and enter

Code: Select all

make REMIX=knob dfu
"Remix" 6: Pass-thru Mouse/Trackball

Finally, a non-remix. Suppose you want to use your input device as designed, but your operating system supports it poorly. You could rewrite the OS driver, but it might be easier just to hack it with this converter firmware.

I found this to be the case for my Targus notebook combo trackball-mouse. It's one of those rare devices I mentioned in Remix 1 that does provide a single control and a single method (an integrated ball) to scroll both axes, and is also wired, has more than one button, etc.

Unfortunately, neither Linux nor macOS correctly interprets this device's horizontal scrolling… probably because Targus awkwardly hacked it into their boot protocol. Never fear; once understood, this problem is relatively straightforward to workaround.

Code: Select all

make REMIX=mousepassthru dfu
With initiative, judicious use of hid_listen (see project root README), and potentially a little theft from evdev, you should be able to decode other device protocols and implement custom support for them.
Last edited by paddle0 on 24 Oct 2020, 17:33, edited 1 time in total.


18 Oct 2020, 23:13

This is exactly what I've been looking for. I just started using a Zaunkoenig M1K for my mouse and since it has no scroll wheel the ergo scroll ball is perfect to pair with it. Thanks for putting this together, and sorry for necro-bumping but I want to try and increase visibility of this post for anyone else with an M1K looking for a scrolling solution.

User avatar

24 Oct 2020, 16:46

Glad to hear it! I'm all about necro-posting :)

I recently learned of a "TracXcroll" kickstarter that supposedly does the same thing: ... e-scroller

Post Reply

Return to “Workshop”