You are not logged in.

#1 2010-11-02 09:58:45

vladimir_1922
Member
Registered: 2010-11-02
Posts: 50

using mouse under console and SDL programs -SOLVED-

Hello to everyone!

Hope someone can help me with a little weird problem, as i am unable to find a proper solution in google (well, it is more of a annoyance for me, not problem)

I tend to spend more time on console than in graphical session. Time ago, everytime i wanted to play a game, or surf the web i had to do a startx, untill i installed Slackware, and somehow it could exec SDL programs and games from the console. I didn't know exactly how, i suspect that started a pseudo X session on 8th terminal. It just happened even with a "minimal install".

But now, atracted by the speed and the posibility of a bleeding edge system i installed Arch. Everything is really good, and i will stay here for a long time, but now that i know there is a way to init SDL programs from the console, i want to know how to do it, and save startx just for use youtube (because links -g doesent have java yet).

I installed gpm, and works really smooth. I saw photos and videos using the framebuffer device, can use svga, so it is good in the graphical part. The standard error when i try to start a game or something is: Could not initialize SDL: Unable to open mouse

Any help is welcome!

Last edited by vladimir_1922 (2010-11-02 13:23:57)

Offline

#2 2010-11-02 11:03:58

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: using mouse under console and SDL programs -SOLVED-

You need permission to access /dev/input/mouse0 or /dev/input/eventX where eventX is your mouse device. Problem is, permission is reset every time you restart (if you create a special mouse group) so maybe you can add a custom udev rules.

Last edited by ChoK (2010-11-02 11:04:27)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#3 2010-11-02 12:04:51

vladimir_1922
Member
Registered: 2010-11-02
Posts: 50

Re: using mouse under console and SDL programs -SOLVED-

Thanks for the fast reponse

As you said it is a problem of permissons, I tried logging as root, and worked. In Slackware I logged as root almost all time, because of lazyness, so this is why i could acces all devices....
I never used udev rules for giving permissons, so im am trying that, i am not very happy to become root just for playing doom. When finding a solution i'll post here.

Offline

#4 2010-11-02 13:22:19

vladimir_1922
Member
Registered: 2010-11-02
Posts: 50

Re: using mouse under console and SDL programs -SOLVED-

Ok, as said.
This is how i resolved it:
-created a group called "mouse" ==> #groupadd -f mouse
-added my user to the group mouse editing /etc/group
-created /etc/udev/rules.d/76-mouse.rules (the first number means the priority, i just added a number up the examples, who started with 75, but you can put another one)

wrote in==> #vim /etc/udev/rules.d/76-mouse.rules

KERNEL=="event?" NAME="input/%k", MODE=660, GROUP="mouse"
KERNEL=="mouse?" NAME="input/%k", MODE=660, GROUP="mouse"
KERNEL=="mice"   NAME="input/%k", MODE=660, GROUP="mouse"

I restarted the computer as udevadm didnt work, checked that ls -l /dev/input showed me that corresponding devices where in group mouse, and tried zdoom as normal user

And it worked fine!

Last edited by vladimir_1922 (2010-11-02 13:22:46)

Offline

Board footer

Powered by FluxBB