Page 3 of 6 FirstFirst 123456 LastLast
Results 21 to 30 of 51

Thread: Boot times

  1. #21
    FLAC TheLlama's Avatar
    Join Date
    Jul 2004
    Location
    All over the world
    Posts
    970
    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?

  2. #22
    Newbie Steels's Avatar
    Join Date
    May 2005
    Posts
    10
    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.

  3. #23
    FLAC TheLlama's Avatar
    Join Date
    Jul 2004
    Location
    All over the world
    Posts
    970
    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.

  4. #24
    FLAC jbors's Avatar
    Join Date
    Nov 2003
    Posts
    959
    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.
    Car pc integration with ease
    Car mediacenter

  5. #25
    FLAC TheLlama's Avatar
    Join Date
    Jul 2004
    Location
    All over the world
    Posts
    970
    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.

  6. #26
    Newbie
    Join Date
    Jun 2003
    Posts
    35
    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.

  7. #27
    FLAC TheLlama's Avatar
    Join Date
    Jul 2004
    Location
    All over the world
    Posts
    970
    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().

  8. #28
    Newbie Steels's Avatar
    Join Date
    May 2005
    Posts
    10
    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

  9. #29
    FLAC TheLlama's Avatar
    Join Date
    Jul 2004
    Location
    All over the world
    Posts
    970
    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.

  10. #30
    Newbie Steels's Avatar
    Join Date
    May 2005
    Posts
    10
    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?

Page 3 of 6 FirstFirst 123456 LastLast

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •