The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Linux

Reply
 
Thread Tools Display Modes
Old 11-08-2005, 09:20 AM   #16
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Thats cool steele. I'm actually in the middle of working on a gui toolkit that runs on X, DirectFB, OpenGL, and VFD Modules. You can see a very simple screenshot by going to http://www.nrrds.org/lbox/ and clicking screen1. What are you going to use to write your interface? I know the new version of QT will run on FB.
TheLlama is offline   Reply With Quote
Sponsored Links
Old 11-08-2005, 09:43 AM   #17
FLAC
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
My Photos: (30)
Quote: Originally Posted by TheLlama
Thats cool steele. I'm actually in the middle of working on a gui toolkit that runs on X, DirectFB, OpenGL, and VFD Modules. You can see a very simple screenshot by going to http://www.nrrds.org/lbox/ and clicking screen1. What are you going to use to write your interface? I know the new version of QT will run on FB.

Either of you know how well SDL plays with DirectFB?

BTW, timed out trying to reach your url.
shotgunefx is offline   Reply With Quote
Old 11-08-2005, 09:46 AM   #18
Newbie
 
Steels's Avatar
 
Join Date: May 2005
Posts: 10
My Photos: (0)
Quote: Originally Posted by TheLlama
Thats cool steele. I'm actually in the middle of working on a gui toolkit that runs on X, DirectFB, OpenGL, and VFD Modules. You can see a very simple screenshot by going to http://www.nrrds.org/lbox/ and clicking screen1. What are you going to use to write your interface? I know the new version of QT will run on FB.

Hey, you writing a toolki for dfb? You're welcome! I am only aware of LiTE, which is under development but i havent seen it yet. I have managed to get gtk on directfb tho, but its not very good.
I am not using any toolkit, i just wrote some very simple stuff for use in my app. Buttons, and the playlist for now.
Your screenshot doesnt load btw , im interested in seeing it

Shotgunefx, youre probably right with the overhead i didnt actually research much about that
Steels is offline   Reply With Quote
Old 11-08-2005, 09:46 AM   #19
Admin
 
Join Date: Aug 2005
Posts: 214
My Photos: (0)
What you really want to check out is PyGame, which is built on top of the Simple DirectMedia layer, which is a cross-platform library that supports multiple hardware platforms, including Windows and the Linux Framebuffer.

-p.
gnomad is offline   Reply With Quote
Old 11-08-2005, 09:53 AM   #20
FLAC
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
My Photos: (30)
Quote: Originally Posted by gnomad
What you really want to check out is PyGame, which is built on top of the Simple DirectMedia layer, which is a cross-platform library that supports multiple hardware platforms, including Windows and the Linux Framebuffer.

-p.

The frontend I'm writing is using Perl and (SDL) Simple DirectMedia layer. My biggest gripe is getting fonts to work properly. Took quite a bit and still have some problems with transparancies.
shotgunefx is offline   Reply With Quote
Sponsored Links
Old 11-08-2005, 10:03 AM   #21
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Quote: Originally Posted by Steels
Your screenshot doesnt load btw , im interested in seeing it

Oops, my IP changed last night. I just updated the DNS server so it should work now (this is all on my cable connection so it isn't the fastest).
It currently supports X, Windows, and VFDs. All you would have to do is subclass the Screen class to form an FBScreen. The toolkit features a relatively powerful drawing system using pens and brushes. I have a variety of controls (widgets) implemented. The others are still waiting for me (lists boxes, combo boxes, etc..). Styling is planned so that widgets will use a variety of functions from a Style class to draw. By reimplementing the Style class you can create your own look and feel. Right now, the only way to do this is by subclassing the actual widgets.

What are you using for input? The only method I could find to reliably get mouse and keyboard events outside of X is to create two threads. Each thread read()s from /dev/input/mice and /dev/input/event0. Are you using GPM?

Last edited by TheLlama : 11-08-2005 at 10:07 AM.
TheLlama is offline   Reply With Quote
Old 11-08-2005, 10:16 AM   #22
Newbie
 
Steels's Avatar
 
Join Date: May 2005
Posts: 10
My Photos: (0)
Quote: Originally Posted by TheLlama
Oops, my IP changed last night. I just updated the DNS server so it should work now (this is all on my cable connection so it isn't the fastest).
It currently supports X, Windows, and VFDs. All you would have to do is subclass the Screen class to form an FBScreen. The toolkit features a relatively powerful drawing system using pens and brushes. I have a variety of controls (widgets) implemented. The others are still waiting for me (lists boxes, combo boxes, etc..). Styling is planned so that widgets will use a variety of functions from a Style class to draw. By reimplementing the Style class you can create your own look and feel. Right now, the only way to do this is by subclassing the actual widgets.

What are you using for input? The only method I could find to reliably get mouse and keyboard events outside of X is to create two threads. Each thread read()s from /dev/input/mice and /dev/input/event0. Are you using GPM?

Directfb has a linux inoput driver, so i hacked the egalax kernel module so it outputs calibrated mouse pointer-ready data.
Someone should write a userspace calibration thingy.
Steels is offline   Reply With Quote
Old 11-08-2005, 10:31 AM   #23
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Cool, that is pretty useful. Btw, here is the same app running in x: http://nrrds.org/ltk/examplex.png . Like I said, one Styles have been implemented you can make the widgets look however you want.
TheLlama is offline   Reply With Quote
Old 11-08-2005, 04:00 PM   #24
FLAC
 
jbors's Avatar
 
Join Date: Nov 2003
Vehicle: VW Golf GL 2000
Posts: 935
My Photos: (0)
Quote: Originally Posted by Steels
Directfb has a linux inoput driver, so i hacked the egalax kernel module so it outputs calibrated mouse pointer-ready data.
Someone should write a userspace calibration thingy.

Just to warn you. Egalax data that DFB sees are not calibrated properly. Another trick is that egalax may switch X, Y or both, so you should account for that. In pycar I had to include userspace calibration utility into the distro so users can calibrate the screen, flip x and y, but if they both flipped they need another distro.
__________________
Car2PC adapter. Car pc integration with ease
Car mediacenter
jbors is offline   Reply With Quote
Old 11-08-2005, 05:48 PM   #25
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Steels, in case you or anyone else is curious, here is a simplified class diagram of the toolkit. http://nrrds.org/ltk/ltk_sdk.png

You can get a better understanding from the detailed one (with operations and attributes). The only problem is my detailed diagram is slightly out of date. I am interested in working with people needing a custom gui solution. I want this TK to be small and robust.
TheLlama is offline   Reply With Quote
Old 11-08-2005, 09:00 PM   #26
Newbie
 
Join Date: Jun 2003
Vehicle: 1994 Acura Integra LS
Posts: 35
My Photos: (0)
Quote: Originally Posted by Steels
Directfb has a linux inoput driver, so i hacked the egalax kernel module so it outputs calibrated mouse pointer-ready data.
Someone should write a userspace calibration thingy.

yes i think thats definitely necessary. does this require another driver to be written, similar to what X uses, that outputs calibrated data? actually, i'm not sure if thats how X works either. what needs to be done to interface correctly? i too want to use DirectFB, and looking forward to your solution.
ruzzmon is offline   Reply With Quote
Old 11-09-2005, 12:50 AM   #27
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Perhaps it would be easier to use gpm. here is some sample code that would do the trick:

Code:
#include <stdio.h> #include <gpm.h> #include <pthread.h> ... void* InputThread(void *arg) { int gpm; Gpm_Connect gpm_connect; Gpm_Event gpm_event; gpm_connect.eventMask = GPM_MOVE | GPM_UP | GPM_DOWN; gpm_connect.defaultMask = 0; gpm_connect.minMod = 0; gpm_connect.maxMod = 0xFFFF; gpm = Gpm_Open(&gpm_connect, 0); if (gpm < 0) { printf("Unable to connect.\n"); return 1; } while(1) { if (Gpm_GetEvent(&gpm_event) != 1) { printf("Unable to read GPM event.\n"); continue; } // Here is where you can modify the mouse position, or // queue a mouse event, etc.. Depends on how you write // your app. mouse_pos.x += gpm_event.dx mouse_pos.y += gpm_event.dy MyMouseHandler(mouse_pos); // Handle clicks with gpm_event.buttons MyMouseButtonHandler(mouse_pos, gpm_event.buttons); } } ... int main(void) { pthread_t input_thread; pthread_create( &input_thread, NULL, InputThread, 0); ... while(1) { HandleEventFromQueue(); DoStuff(); } }

You may need to add code to break out of the thread. Your event queue must also provide mutual exclusion. Alternately, if you are not using threads, you can place the code from the thread routine in your main loop. Since Gpm_GetEvent() is blocking you can simply do a select() first to see if data is available. If not, then don't run Gpm_GetEvent().

Last edited by TheLlama : 11-09-2005 at 12:56 AM.
TheLlama is offline   Reply With Quote
Old 11-09-2005, 09:20 AM   #28
Newbie
 
Steels's Avatar
 
Join Date: May 2005
Posts: 10
My Photos: (0)
Quote: Originally Posted by TheLlama
Perhaps it would be easier to use gpm. here is some sample code that would do the trick:

Code:
#include <stdio.h> #include <gpm.h> #include <pthread.h> ... void* InputThread(void *arg) { int gpm; Gpm_Connect gpm_connect; Gpm_Event gpm_event; gpm_connect.eventMask = GPM_MOVE | GPM_UP | GPM_DOWN; gpm_connect.defaultMask = 0; gpm_connect.minMod = 0; gpm_connect.maxMod = 0xFFFF; gpm = Gpm_Open(&gpm_connect, 0); if (gpm < 0) { printf("Unable to connect.\n"); return 1; } while(1) { if (Gpm_GetEvent(&gpm_event) != 1) { printf("Unable to read GPM event.\n"); continue; } // Here is where you can modify the mouse position, or // queue a mouse event, etc.. Depends on how you write // your app. mouse_pos.x += gpm_event.dx mouse_pos.y += gpm_event.dy MyMouseHandler(mouse_pos); // Handle clicks with gpm_event.buttons MyMouseButtonHandler(mouse_pos, gpm_event.buttons); } } ... int main(void) { pthread_t input_thread; pthread_create( &input_thread, NULL, InputThread, 0); ... while(1) { HandleEventFromQueue(); DoStuff(); } }

You may need to add code to break out of the thread. Your event queue must also provide mutual exclusion. Alternately, if you are not using threads, you can place the code from the thread routine in your main loop. Since Gpm_GetEvent() is blocking you can simply do a select() first to see if data is available. If not, then don't run Gpm_GetEvent().

Sounds to my like a good idea! So, one would use a userspace app to calibrate, then gpm uses that data to directly output calibrated data?

I'm sorry, im really just learning programming this year, icant follow your code too well
Steels is offline   Reply With Quote
Old 11-09-2005, 10:57 AM   #29
FLAC
 
TheLlama's Avatar
 
Join Date: Jul 2004
Location: All over the world
Vehicle: 2001 Paper Airplane Standard Edition
Posts: 984
My Photos: (0)
Gpm works several different ways. In one mode you can use the function Gpm_GetEvent() to get the next mouse event. If one hasn't occured, then the function waits until one is available. Therefore, you can't put the function directly in your main loop. If you did, then your program couldn't do anything until the user moved the mouse.

So, we break it off into its own thread. You should learn about pthreads. If you want to write a decent frontend I'll guarantee they will make your life easier.

Alternatively, you can put the function in your main loop. You can use select() before the Gpm_GetEvent(). Here is what the nonthreaded version looks like.

Code:
#include <stdio.h> #include <errno.h> #include <sys/time.h> #include <sys/types.h> #include <sys/select.h> #include <gpm.h> int mouse_pos_x; int mouse_pos_y; unsigned char mouse_buttons; int InitGPM() { Gpm_Connect gpm_connect; gpm_connect.eventMask = GPM_MOVE | GPM_UP | GPM_DOWN; gpm_connect.defaultMask = 0; gpm_connect.minMod = 0; gpm_connect.maxMod = 0xFFFF; // Connect to Gpm return Gpm_Open(&gpm_connect, 0); } int main(void) { /* the gpm file descriptor */ int gpm; /* holds a gpm event */ Gpm_Event gpm_event; /* A list of file descriptors we want select() to wait for. */ fd_set fds; int running = 1; int result; int c; struct timeval tv; /* I'm using these for animation */ int anim_cnt = 1; mouse_pos_x = 0; mouse_pos_y = 0; mouse_buttons = 0x00; /* Initialize GPM */ gpm = InitGPM(); if (gpm < 0) { printf("Unable to connect to GPM.\n"); return 1; } // Our main loop while(running) { /* Clear the file descriptor set. */ FD_ZERO(&fds); /* Add GPM to the file descriptor set. */ FD_SET(gpm, &fds); /* You could add other file descriptors you want to "grab". * Example: keyboard, serial mice, maybe some proc file, etc.. */ /* Initialize the timeout. If none of the file descriptors change * status within this period of time, then select will return anyways. */ tv.tv_sec = 0; tv.tv_usec = 20000; /* Block until we receive input or until the timeout elapses. */ result = select(gpm+1, &fds, NULL, NULL, &tv); if (result < 0) { /* Is something fubar'd? */ if (errno == EINTR) continue; /* no, but we need to wait again. */ printf("select failed: %s\n", strerror(errno)); break; /* yes, exit */ } if (result > 0) { /* A mouse event is available, get it. */ if (Gpm_GetEvent(&gpm_event) != 1) { printf("Unable to read an event.\n"); break; } /* gpm_event has 5 members we are concerned about. * .x and .y are the absolute positions (in character * on the screen. .dx and .dy are better for us, so we * can just keep track of absolute position ourselves. * The final parameter, .buttons, is a bitmask of which * buttons are pressed. I'll just show a simplified solution * that uses a global mouse position. */ mouse_pos_x += gpm_event.dx; mouse_pos_y += gpm_event.dy; mouse_buttons = gpm_event.buttons; /* You probably want to call some function to handle the mouse event */ printf("x: %d x: %d dx: %d dy: %d Buttons: %X\n", gpm_event.x, gpm_event.y, gpm_event.dx, gpm_event.dy, gpm_event.buttons); } else { /* No data is ready, so you can do something else. For example, * animate the screen, do some processing. We will just draw a * little ascii animation to get the point across. */ printf("["); for(c = 0; c < abs(10-anim_cnt); c++) printf("-"); printf("#"); for(; c < 10; c++) printf("-"); printf("]\r"); if (++anim_cnt == 20) anim_cnt = 0; fflush(stdout); } } return 0; }

I'm not at a computer where I can test this code, so it may or may not work. I'll try it when I get home and fix it if need be.

EDIT: Tested the code, I forgot to declare two variables. It should work now. You should compile it with: gcc myfile.c -o myfile -lgpm
Note: You will not be able to connect to Gpm if X is running.

Last edited by TheLlama : 11-09-2005 at 01:39 PM.
TheLlama is offline   Reply With Quote
Old 11-09-2005, 01:56 PM   #30
Newbie
 
Steels's Avatar
 
Join Date: May 2005
Posts: 10
My Photos: (0)
I get it.
But i find it quite easy to use dfb's input event buffer.

The problem is standardization of calibration under linux. Is it better to hack the kernel dirver, x11 driver, dfb driver or gpm?
Steels is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to optimize Windows XP boot times 12Vsystems WinNT Based 1 05-12-2005 11:36 AM
Question about M10000 boot times - very slow.. kingvitamin General Hardware Discussion 8 05-07-2005 04:53 PM
Question On Boot Times mybrotherrob General MP3Car Discussion 19 05-04-2005 11:32 PM
Mac Boot Times BiohazrD MacCar 10 01-21-2005 11:33 PM
Decreasing boot times schrodos Software & Software Development 22 02-07-2001 05:42 PM


All times are GMT -5. The time now is 02:18 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics