Using a teensy 4.1 to filter/transform a mouse?

Status
Not open for further replies.

Claghorn

Member
I see the teensy 4.1 has a primary USB connector which can act as a HID and (if I add the pins) a second USB host connector. Would it be reasonable to use a 4.1 to build a gadget to map buttons and add drag lock capabilities to a mouse utterly independent of any operating system or GUI interface I'm using the mouse on?

I also wonder if the whole thing could be powered via the primary USB connection (though that isn't as important).

Background: Linux distros keep threatening to switch from X11 to Wayland, but after years and years of Wayland development, none of the GUI interfaces seem to offer the same capabilities for configuring buttons as have always been available under X11, and even if they someday offer it, it will be implemented in the "compositor" which means it might not exist in some flavors of user interface. If I can do all my mapping with external hardware, I won't care how pitiful the GUI support is :). I need this to make operating a Kensington Expert Wireless Trackball Mouse a dream experience rather than a nightmare requiring two hands and playing twister with my fingers. It also seems like it might be a fun project.
 
I don't know how exactly you want to transform the mouse input, but as long as "new/virtual" position and button states can be calculated from the position and buttons states of the connected mouse it certainly is possible. Use something like this https://www.pjrc.com/store/cable_usb_host_t36.html to connect the mouse to the Teensy and connect the Teensy to the PC as usual. Then choose one of the USB modes including "MOUSE" and you are ready to go. No additional power supply necessary.

Some years ago I did a very quick feasibility to smooth the mouse movement for a user with Parkinson. See here https://forum.arduino.cc/t/parkinsons-disease-mouse-project/589394/7?u=luni64 for the setup and code which might give you a head start.
 
Initially what I want is very simple and I'd probably hard code it in the software. I want to swap a couple of mouse buttons around to get the one I want to use as button 1 to report button 1 to the computer, etc. Slightly more complicated, I want to use one of the four buttons on my trackball as a "drag lock" when I click it once, report button 1 pressed to the computer, and when I click it again, report button 1 release. Every thing else, just pass through to the computer. Long term, since there is an sdcard slot on the 4.1, maybe instead of hard coding the way it works, read a config file to allow more complicated tricks to be implemented without having to recompile.
 
Status
Not open for further replies.
Back
Top