SDL works only for root

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;
}

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 wrote:

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 (@Lz1).
http://elezeta.bounceme.net

IraqiGeek wrote:

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

IraqiGeek wrote:

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.comOn Sunday, January 08, 2006 6:11 PM GMT, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

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 wrote:

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

IraqiGeek wrote:

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 (@Lz1).
http://elezeta.bounceme.net

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 :slight_smile:

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

Regards,
IraqiGeek
www.iraqigeek.comOn Sunday, January 08, 2006 7:14 PM GMT, Lz wrote:

IraqiGeek wrote:> On Sunday, January 08, 2006 6:11 PM GMT, Stephane Marchesin <@Stephane_Marchesin> wrote:

IraqiGeek wrote:

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

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 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.comOn Sunday, January 08, 2006 8:51 PM GMT, Ryan C. Gordon wrote:

IraqiGeek wrote:

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,
RicardoEm Domingo, 8 de Janeiro de 2006 18:37, o IraqiGeek escreveu:

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

Regards,
IraqiGeek
www.iraqigeek.com


Security check: aaaINTRUDER ALERT!