# Simple newbie question

**URL:** <https://discourse.libsdl.org/t/simple-newbie-question/16434>\
**Category:** SDL Development\
**Created:** [July 2, 2009, 11:08am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434 "2009-07-02T11:08:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![not\_disclosed](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@not\_disclosed](https://discourse.libsdl.org/u/not_disclosed)\
**Post date:** [July 2, 2009, 11:08am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/1 "2009-07-02T11:08:51Z")

</div>

Dear SDL list,

I have a simple question but can’t find the correct search to find the answer. I am using linux on a beagleboard  
which boots with an X session on its DVI output. Since the device has no mouse or keyboard I access it remotely over ssh.

For my application I want to use SDL to control the DVI output but I have no idea how to do this - generally when I run my  
test application it sends the output over X to the development host. If I disable X-forwarding it just says no video device  
available. Both of which are sensible. Beyond this I am not sure where to start - I presume that I should find a way to disable  
the X-session and install a framebuffer device (but I don’t know how) and then I will need a way to grab this interface even  
though I don’t own the console.

Any suggestions for starting points?

thanks,

Sa\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
More than messages?check out the rest of the Windows Live?.  
[http://www.microsoft.com/windows/windowslive/](http://www.microsoft.com/windows/windowslive/)

---

<div class="post-metadata">

**Author:** ![Donny\_Viszneki](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/donny_viszneki/32/360_2.png) [@Donny\_Viszneki](https://discourse.libsdl.org/u/Donny_Viszneki)\
**Post date:** [July 2, 2009, 7:32pm UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/2 "2009-07-02T19:32:02Z")

</div>

This is actually not an SDL question so much as it is an X question.  
But it’s very simple, so here’s what you need to concern yourself  
with:

X applications determine which server they connect to by checking the  
DISPLAY environment variable. Here is a pretty good guess:

DISPLAY=:0.0 ./testvidinfo

See how that works out for you!On Thu, Jul 2, 2009 at 7:08 AM, not disclosed wrote:

> Dear SDL list,
> 
> I have a simple question but can’t find the correct search to find the  
> answer.? I am using linux on a beagleboard  
> which boots with an X session on its DVI output.? Since the device has no  
> mouse or keyboard I access it remotely over ssh.
> 
> For my application I want to use SDL to control the DVI output but I have no  
> idea how to do this - generally when I run my  
> test application it sends the output over X to the development host.? If I  
> disable X-forwarding it just says no video device  
> available. Both of which are sensible. Beyond this I am not sure where to  
> start - I presume that I should find a way to disable  
> the X-session and install a framebuffer device (but I don’t know how) and  
> then I will need a way to grab this interface even  
> though I don’t own the console.
> 
> Any suggestions for starting points?
> 
> thanks,
> 
> Sa
> 
> * * *
> 
> check out the rest of the Windows Live?. More than mail?Windows Live? goes  
> way beyond your inbox. More than messages
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

–  
[http://codebad.com/](http://codebad.com/)

---

<div class="post-metadata">

**Author:** ![Pierre\_Phaneuf](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/pierre_phaneuf/32/94_2.png) [@Pierre\_Phaneuf](https://discourse.libsdl.org/u/Pierre_Phaneuf)\
**Post date:** [July 2, 2009, 8:16pm UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/3 "2009-07-02T20:16:41Z")

</div>

> For my application I want to use SDL to control the DVI output but I have no  
> idea how to do this - generally when I run my  
> test application it sends the output over X to the development host.? If I  
> disable X-forwarding it just says no video device  
> available. Both of which are sensible. Beyond this I am not sure where to  
> start - I presume that I should find a way to disable  
> the X-session and install a framebuffer device (but I don’t know how) and  
> then I will need a way to grab this interface even  
> though I don’t own the console.

If you have no input device whatsoever, X won’t cut it for you (well,  
unless you can deal with having no input in your application?!? might  
be the case if your thing is used as a monitoring/status display,  
say). If you used the framebuffer support, I think you could SSH in,  
and the keyboard input could come from your SSH session, but there  
would be no mouse. I’m not sure if SDL can deal with keyboard input  
through stdin, or if the framebuffer support tries to open  
/dev/console or something like that? You might have to hack it a bit,  
or just do your keyboard input yourself.

The beagleboard has USB, no? The easiest thing to do would probably be  
to plug a mouse in there, which would allow you to both use the mouse  
with the framebuffer (and get keyboard input through SSH), or to just  
run an X server (which won’t be able to get the keyboard input from  
your SSH, but you could also plug in a USB keyboard, of course).On Thu, Jul 2, 2009 at 7:08 AM, not disclosed wrote:

–  
[http://www.google.com/profiles/pphaneuf](http://www.google.com/profiles/pphaneuf)

---

<div class="post-metadata">

**Author:** ![not\_disclosed](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@not\_disclosed](https://discourse.libsdl.org/u/not_disclosed)\
**Post date:** [July 3, 2009, 7:45am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/4 "2009-07-03T07:45:40Z")

</div>

Thanks to pphaneuf and donny.viszneki for swift replies:

Donny’s suggestion works\* but I still have the pointer on the screen.

I thought I might explain a little more about what I am after:

I need no keyboard or mouse input, I am just using the beagleboard to drive a  
video projector chip. The input will come over the network via a home made protocol  
or from a USB webcam attached to the device. Its a bit complex but in simple terms  
I’ll read input from the webcam, process it and output the results to the video  
device.

I’d prefer it if I could strip X out of the system. It might be that I don’t even need  
SDL, although it is a nice interface that I like. If I need to stick with X I need  
to find a way to get rid of the pointer (which is present even though there is no  
mouse).

Any more suggestions?

Thanks for you help,

Sa

- I suppose I am so used to X barring none owners from the display when ,  
someone is logged on it didn’t occur to me this was possible!\> Date: Thu, 2 Jul 2009 16:16:41 -0400

> From: pphaneuf at [gmail.com](http://gmail.com)  
> To: sdl at [lists.libsdl.org](http://lists.libsdl.org)  
> Subject: Re: [SDL] Simple newbie question
> 
> On Thu, Jul 2, 2009 at 7:08 AM, not disclosed\<@not\_disclosed\> wrote:
> 
> > For my application I want to use SDL to control the DVI output but I have no  
> > idea how to do this - generally when I run my  
> > test application it sends the output over X to the development host. If I  
> > disable X-forwarding it just says no video device  
> > available. Both of which are sensible. Beyond this I am not sure where to  
> > start - I presume that I should find a way to disable  
> > the X-session and install a framebuffer device (but I don’t know how) and  
> > then I will need a way to grab this interface even  
> > though I don’t own the console.
> 
> If you have no input device whatsoever, X won’t cut it for you (well,  
> unless you can deal with having no input in your application?!? might  
> be the case if your thing is used as a monitoring/status display,  
> say). If you used the framebuffer support, I think you could SSH in,  
> and the keyboard input could come from your SSH session, but there  
> would be no mouse. I’m not sure if SDL can deal with keyboard input  
> through stdin, or if the framebuffer support tries to open  
> /dev/console or something like that? You might have to hack it a bit,  
> or just do your keyboard input yourself.
> 
> The beagleboard has USB, no? The easiest thing to do would probably be  
> to plug a mouse in there, which would allow you to both use the mouse  
> with the framebuffer (and get keyboard input through SSH), or to just  
> run an X server (which won’t be able to get the keyboard input from  
> your SSH, but you could also plug in a USB keyboard, of course).
> 
> –  
> [http://www.google.com/profiles/pphaneuf](http://www.google.com/profiles/pphaneuf)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

* * *

Invite your mail contacts to join your friends list with Windows Live Spaces. It’s easy!  
[http://spaces.live.com/spacesapi.aspx?wx\_action=create&wx\_url=/friends.aspx&mkt=en-us](http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us)

---

<div class="post-metadata">

**Author:** ![Pierre\_Phaneuf](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/pierre_phaneuf/32/94_2.png) [@Pierre\_Phaneuf](https://discourse.libsdl.org/u/Pierre_Phaneuf)\
**Post date:** [July 3, 2009, 8:43am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/5 "2009-07-03T08:43:12Z")

</div>

> I need no keyboard or mouse input, I am just using the beagleboard to drive  
> a  
> video projector chip.? The input will come over the network via a home made  
> protocol  
> or from a USB webcam attached to the device. Its a bit complex but in simple  
> terms  
> I’ll read input from the webcam, process it and output the results to the  
> video  
> device.

Ah, well then, if that’s the case, you might want to take a look at  
the SDL\_ShowCursor function, should let you hide the cursor. 🙂

> I’d prefer it if I could strip X out of the system.? It might be that I  
> don’t even need  
> SDL, although it is a nice interface that I like.? If I need to stick with X  
> I need  
> to find a way to get rid of the pointer (which is present even though there  
> is no  
> mouse).

If you need no input at all, you can keep developing with X, and  
whenever you feel like getting rid of it, take a look at compiling a  
version of SDL with framebuffer support. Normally, your program should  
work pretty much unmodified, you just won’t need X to be running  
anymore! Note that the framebuffer support doesn’t include OpenGL  
(that I know of), so you might be restricted to 2D only (on the other  
hand, I suspect that if there’s hardware 3D at all on the beagleboard,  
it’s probably not much to speak of anyway)…On Fri, Jul 3, 2009 at 3:45 AM, not disclosed wrote:

–  
[http://www.google.com/profiles/pphaneuf](http://www.google.com/profiles/pphaneuf)

---

<div class="post-metadata">

**Author:** ![not\_disclosed](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@not\_disclosed](https://discourse.libsdl.org/u/not_disclosed)\
**Post date:** [July 3, 2009, 9:07am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/6 "2009-07-03T09:07:47Z")

</div>

Thanks again-

I have just discovered I can do this:

main(){  
int fbdev;  
unsigned int \*fb;

fbdev=open(“/dev/fb0”, O\_RDWR);  
fb=(unsigned int _)mmap(0, 640_480\*sizeof(unsigned int), PROT\_WRITE, MAP\_SHARED, fbdev, 0);

Which is ideal for me and I think all I need to do is get rid of X now…

Thanks,

SA\> Date: Fri, 3 Jul 2009 04:43:12 -0400

> From: pphaneuf at [gmail.com](http://gmail.com)  
> To: sdl at [lists.libsdl.org](http://lists.libsdl.org)  
> Subject: Re: [SDL] Simple newbie question
> 
> On Fri, Jul 3, 2009 at 3:45 AM, not disclosed\<@not\_disclosed\> wrote:
> 
> > I need no keyboard or mouse input, I am just using the beagleboard to drive  
> > a  
> > video projector chip. The input will come over the network via a home made  
> > protocol  
> > or from a USB webcam attached to the device. Its a bit complex but in simple  
> > terms  
> > I’ll read input from the webcam, process it and output the results to the  
> > video  
> > device.
> 
> Ah, well then, if that’s the case, you might want to take a look at  
> the SDL\_ShowCursor function, should let you hide the cursor. 🙂
> 
> > I’d prefer it if I could strip X out of the system. It might be that I  
> > don’t even need  
> > SDL, although it is a nice interface that I like. If I need to stick with X  
> > I need  
> > to find a way to get rid of the pointer (which is present even though there  
> > is no  
> > mouse).
> 
> If you need no input at all, you can keep developing with X, and  
> whenever you feel like getting rid of it, take a look at compiling a  
> version of SDL with framebuffer support. Normally, your program should  
> work pretty much unmodified, you just won’t need X to be running  
> anymore! Note that the framebuffer support doesn’t include OpenGL  
> (that I know of), so you might be restricted to 2D only (on the other  
> hand, I suspect that if there’s hardware 3D at all on the beagleboard,  
> it’s probably not much to speak of anyway)…
> 
> –  
> [http://www.google.com/profiles/pphaneuf](http://www.google.com/profiles/pphaneuf)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

* * *

Windows Live?: Keep your life in sync. Check it out!  
[http://windowslive.com/explore?ocid=TXT\_TAGLM\_WL\_t1\_allup\_explore\_012009](http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009)

---

<div class="post-metadata">

**Author:** ![Kenneth\_Bull](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@Kenneth\_Bull](https://discourse.libsdl.org/u/Kenneth_Bull)\
**Post date:** [July 3, 2009, 11:04am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/7 "2009-07-03T11:04:40Z")

</div>

now that’s nice…  
short, sweet, and completely unportable.

I just wish it were practical for games, etc…On Friday, 3 July 2009 05:07:47 not disclosed wrote:

> Thanks again-
> 
> I have just discovered I can do this:
> 
> main(){  
> int fbdev;  
> unsigned int \*fb;
> 
> fbdev=open(“/dev/fb0”, O\_RDWR);  
> fb=(unsigned int _)mmap(0, 640_480\*sizeof(unsigned int), PROT\_WRITE,  
> MAP\_SHARED, fbdev, 0);
> 
> Which is ideal for me and I think all I need to do is get rid of X now…
> 
> Thanks,
> 
> SA

---

<div class="post-metadata">

**Author:** ![not\_disclosed](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@not\_disclosed](https://discourse.libsdl.org/u/not_disclosed)\
**Post date:** [July 3, 2009, 11:49am UTC](https://discourse.libsdl.org/t/simple-newbie-question/16434/8 "2009-07-03T11:49:33Z")

</div>

It doesn’t matter that it isn’t portable for me - the hardware cannot run anywhere else - it is a one off…

The one problem I have remaining is that I can disable X fine and after I disable X I have a working  
framebuffer. The problem is if my display is disconnected and reconnected (or not turned on before  
X etc), the display no longer works. I can fix this by starting X and stopping it but I haven’t been able  
to emulate this from my own code. I know this is not the place but does anyone know how to kick the  
framebuffer back into life? (using omapfb).

Cheers,

SA\> From: llubnek at [gmail.com](http://gmail.com)

> To: sdl at [lists.libsdl.org](http://lists.libsdl.org)  
> Date: Fri, 3 Jul 2009 07:04:40 -0400  
> Subject: Re: [SDL] Simple newbie question
> 
> On Friday, 3 July 2009 05:07:47 not disclosed wrote:
> 
> > Thanks again-
> > 
> > I have just discovered I can do this:
> > 
> > main(){  
> > int fbdev;  
> > unsigned int \*fb;
> > 
> > fbdev=open(“/dev/fb0”, O\_RDWR);  
> > fb=(unsigned int _)mmap(0, 640_480\*sizeof(unsigned int), PROT\_WRITE,  
> > MAP\_SHARED, fbdev, 0);
> > 
> > Which is ideal for me and I think all I need to do is get rid of X now…
> > 
> > Thanks,
> > 
> > SA
> 
> now that’s nice…  
> short, sweet, and completely unportable.
> 
> I just wish it were practical for games, etc…
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

* * *

Invite your mail contacts to join your friends list with Windows Live Spaces. It’s easy!  
[http://spaces.live.com/spacesapi.aspx?wx\_action=create&wx\_url=/friends.aspx&mkt=en-us](http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us)
