0
\$\begingroup\$

I am working on (not really a game, but it's using pygame so I hope my question is on topic here).

The program appears to be looking at /dev/input/event0, which is random USB mouse, just like the desktop environment and everything else is. But what I need is for pygame.mouse to be "connected" (not sure of the right word here) to /dev/input/event2, which is the USB touchscreen.

I've figured these two paths out by using evtest /dev/input/event2 and seeing which one responds to being fingered but I have not figured out how to configure pygame to look at the right one, is there a way or is this hardwired somehow?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

It turns out that this is controlled by environment variables.

You need to set SDL_FBDEV, which controls which framebuffer to use. Then, you can use SDL_MOUSEDEV to control which device to use for the mouse.

Something like this:

SDL_FBDEV=/dev/fb0 SDL_MOUSEDEV=/dev/input/event2 sudo python3 muffin.py

(I haven't yet figured out why I need sudo here to use that framebuffer. It has 660 perms and I'm a member of the video group, so maybe some other process is interfering somehow)

\$\endgroup\$
1
  • \$\begingroup\$ Now I just need to figure out why X and Y axes are swapped. \$\endgroup\$ Mar 11, 2022 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .