The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL works only for root
IraqiGeek
Guest

Hi all,

I was finally able to get SDL running on LFS under vmware (sorta, cause I
still cant get 24-bit color, but at least its working on 16-bit).

Now, what happens is that if I run the test code below as root, it works
fine, but if I run it as another user, it get back to "no available video
device". How to get SDL running for everybody?


#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
SDL_Surface *screen;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

atexit(SDL_Quit);
screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);

if (screen == NULL) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}

printf("Success!\n");
return 0;
}
SDL works only for root
Lz
Guest

Hello, be sure you got the right privileges on the device... was it
/dev/fb0? then adding your user to the group which owns /dev/fb0 will
work :)

On 1/8/06, IraqiGeek <geek at iraqigeek.com> wrote:
Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta, cause I
still cant get 24-bit color, but at least its working on 16-bit).

Now, what happens is that if I run the test code below as root, it works
fine, but if I run it as another user, it get back to "no available video
device". How to get SDL running for everybody?


#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
SDL_Surface *screen;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

atexit(SDL_Quit);
screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);

if (screen == NULL) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}

printf("Success!\n");
return 0;
}


_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl



--
Lz (elezeta at gmail.com).
http://elezeta.bounceme.net
SDL works only for root
Stephane Marchesin
Guest

IraqiGeek wrote:

Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta,
cause I still cant get 24-bit color, but at least its working on 16-bit).

Now, what happens is that if I run the test code below as root, it
works fine, but if I run it as another user, it get back to "no
available video device". How to get SDL running for everybody?


It's not SDL that needs to be configured, but your fb device. Change the
/dev/fb0 permissions to allow other users to use it.

Stephane
SDL works only for root
IraqiGeek
Guest

On Sunday, January 08, 2006 6:11 PM GMT,
Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

Quote:
IraqiGeek wrote:

Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta,
cause I still cant get 24-bit color, but at least its working on
16-bit). Now, what happens is that if I run the test code below as root,
it
works fine, but if I run it as another user, it get back to "no
available video device". How to get SDL running for everybody?


It's not SDL that needs to be configured, but your fb device. Change
the /dev/fb0 permissions to allow other users to use it.

Stephane

I changed the permissions for fb0 to 766, and now it works for all, but
since the system uses udev, do I have to do the chmod on every restart now?

Regards,
IraqiGeek
www.iraqigeek.com
SDL works only for root
Lz
Guest

you may want to try this from root console:
echo chmod 0766 /dev/fb0 > /etc/rcS.d/S99framebuffer;chmod 0766
/etc/rcS.d/S99framebuffer

that might run the chmod whenever you restart :)

On 1/8/06, IraqiGeek <geek at iraqigeek.com> wrote:
Quote:
On Sunday, January 08, 2006 6:11 PM GMT,
Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

Quote:
IraqiGeek wrote:

Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta,
cause I still cant get 24-bit color, but at least its working on
16-bit). Now, what happens is that if I run the test code below as root,
it
works fine, but if I run it as another user, it get back to "no
available video device". How to get SDL running for everybody?


It's not SDL that needs to be configured, but your fb device. Change
the /dev/fb0 permissions to allow other users to use it.

Stephane

I changed the permissions for fb0 to 766, and now it works for all, but
since the system uses udev, do I have to do the chmod on every restart now?

Regards,
IraqiGeek
www.iraqigeek.com



_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl



--
Lz (elezeta at gmail.com).
http://elezeta.bounceme.net
SDL works only for root
IraqiGeek
Guest

On Sunday, January 08, 2006 7:14 PM GMT,
Lz <elezeta at gmail.com> wrote:

Quote:
you may want to try this from root console:
echo chmod 0766 /dev/fb0 > /etc/rcS.d/S99framebuffer;chmod 0766
/etc/rcS.d/S99framebuffer

that might run the chmod whenever you restart :)


I thought about doing that, but was hoping of finding a "cleaner" way of
doing it.

Regards,
IraqiGeek
www.iraqigeek.com
SDL works only for root
Stephane Marchesin
Guest

IraqiGeek wrote:

Quote:
On Sunday, January 08, 2006 6:11 PM GMT,
Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

Quote:
IraqiGeek wrote:

Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta,
cause I still cant get 24-bit color, but at least its working on
16-bit). Now, what happens is that if I run the test code below as
root, it
works fine, but if I run it as another user, it get back to "no
available video device". How to get SDL running for everybody?



It's not SDL that needs to be configured, but your fb device. Change
the /dev/fb0 permissions to allow other users to use it.

Stephane


I changed the permissions for fb0 to 766, and now it works for all,
but since the system uses udev, do I have to do the chmod on every
restart now?

This is off-topic for this mailing list, but that can be setup in /etc/udev

Stephane
SDL works only for root
Ryan C. Gordon
Guest

Quote:
I thought about doing that, but was hoping of finding a "cleaner" way of
doing it.

Ubuntu has a /etc/udev/permissions.rules config file. Look around in there.

--ryan.
SDL works only for root
IraqiGeek
Guest

On Sunday, January 08, 2006 8:51 PM GMT,
Ryan C. Gordon <icculus at icculus.org> wrote:

Quote:
Quote:
I thought about doing that, but was hoping of finding a "cleaner"
way of doing it.

Ubuntu has a /etc/udev/permissions.rules config file. Look around in
there.

--ryan.

I will look into that. Thanks to all for your help.

Regards,
IraqiGeek
www.iraqigeek.com
SDL works only for root
Ricardo Cruz
Guest

Em Domingo, 8 de Janeiro de 2006 18:37, o IraqiGeek escreveu:
Quote:
On Sunday, January 08, 2006 6:11 PM GMT,

Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:
Quote:
IraqiGeek wrote:
Quote:
Hi all,

I was finally able to get SDL running on LFS under vmware (sorta,
cause I still cant get 24-bit color, but at least its working on
16-bit). Now, what happens is that if I run the test code below as root,
it
works fine, but if I run it as another user, it get back to "no
available video device". How to get SDL running for everybody?

It's not SDL that needs to be configured, but your fb device. Change
the /dev/fb0 permissions to allow other users to use it.

Stephane

I changed the permissions for fb0 to 766, and now it works for all, but
since the system uses udev, do I have to do the chmod on every restart now?

Like someone already said the best thing is to add the users you want to
access fbdev to the group that has access to it.

Look for the group that has access to the fb0 device with a "ls -l" and then
add the users you wish to that group.

Cheers,
Ricardo

Quote:
Regards,
IraqiGeek
www.iraqigeek.com


--
Security check: INTRUDER ALERT!