[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How to prevent mouse initialization in Pygame





четверг, 13 июля 2017 г., 23:22:27 UTC+3 пользователь Martin Kühne написал:
Also Roman, please note that
many ioctls return data in pointers that can be passed to them which
should be the spot where your results actually differ.


I remember that, in particular, VT_OPENQRY accepts pointer to integer to store result. In my experiments I printed to stdout value of integer pointed to, not the pointer itself.

пятница, 14 июля 2017 г., 19:33:29 UTC+3 пользователь Alec Bennett написал:
Another possibility would be to execute a command that moves the mouse way off screen?


I think the title of this discussion thread became confusing, because my goal is not to just get rid of mouse pointer, but rather get rid of necessity to run pygame-based script as root. When I started this thread I thought that need for root rights was a consequence of mouse initialization. But now with help of kind people here I realized that the problem is not mouse but keyboard/console terminal initialization instead.

As the moment I think that more correct title for this discussion thread would be “How to run pygame framebuffer graphics without root rights” or something similar.


I started thinking about looking into SDL sources already, but I was hoping there is an easier way. But after Annette’s reply with direct references to relevant points in the code I realized that time has come :) Thank you very much Annette for your help!

I succeeded with SDL compilation from libSDL 1.2 sources for Debian using this really simple and working instruction. Here are first results.

First I commented out FB_OpenKeyboard call in SDL_fbvideo.c, but that lead to pygame error without descriptive error message, so I reverted my changes and tried removing check for root rights inside FB_OpenKeyboard. This revealed necessity to add read permissions to the tty group on the /dev/tty2 device. After fixing that, the failing system call now is:

ioctl(5, VT_ACTIVATE, 0x2)              = -1 EPERM (Operation not permitted)

I’ve spent some time investigating this but haven’t find complete solution yet.

Taking into account that my ultimate goal is to run pygame without root rights as a daemon, I suppose completely eliminating keyboard/console terminal initialization is a more promising direction.

Let me know in case you have any advice or suggestion.