/dev/mouse0 on Raspberry Pi


I’m a newbie OF-user trying some experiments on the Pi, which is really good working except this one issue:

I’m not able to receive Mouse(Touch in my Case)-Data in an OF-app launched without X11, but directly from the Terminal.

First, i thought, the mouse isn’t working at all in the terminal, but then I realized, that a cat /dev/mouse0 does output some bytecode, when touching my touchscreen-device.

Reading some old threads, created about a year ago, i saw, that it was some kind of a challenge to get the mouse working in GLES-Renderer,m but to my understanding that issue was solved about a year ago.

It would be supernice, if anyone could point me in the right direction on where to dig for that topic. Or, is there a way/example that grabs the mouse-input directly or raw?

Thanks in advance,

Here is how OF is finding the mouse on the RPi

It sounds like you have a touchscreen that is supposed to send events (as a mouse). If OF is not seeing it as a mouse you could probably use something like this in ofApp


thanks @jvcleave

that helped me a lot!

i needed to change ofAppEGLWindow.cpp to have the mouse working. i used evtest to inspect the mouse-events and transfered some bits like keycodes etc.

But maybe it’s not the best idea to change a core-file that way… is there a suggested way in OF to handle extensions like that? Can i somehow override the relevant methods in ofAppEGLWindow.cpp?

but anyway,

The proper way is probably to extend ofAppEGLWindow but a cheap way of doing it is just to copy ofAppEGLWindow.cpp into your project’s src folder and rename it (and the class) something like (e.g. myEGLWindow.cpp)

1 Like