From: SunitM <s.m...@gm...> - 2008-03-22 08:05:31
|
To answer my own post, My issue was the Directfb configuration having the module "linux_input" enabled when I build the Directfb package. I was able to disable the linux_input option in a .directfbrc file in my home directly and was then able to see my /dev/input/event0 mouse clicks within my code again. Next time I have to rebuild Directfb for my buildroot, I will disable linux-input when I run my ./configure process. -Sunit SunitM wrote: > > Hello, > > I have been developing up a couple of simple, but different applications > to use for my Verdex XM4 + ConsoleLCD-vx + Samsung LCD setup. > > One app uses the button clicks (as events) of a USB mouse to control the > output of GPIO signals to control a hacked remote for a TV. I based my > GPIO code on the sample code on the docwiki and use /dev/input/event0 to > capture my mouse events. > > The second app is based on Directfb sample code for the Directfb website > where I load different .png images to the Samsung LCD. > > What I have having issues with is when I try to merge the code together (I > am putting into one .c file), my mouse events don't get recognized like > they did when I ran my first app by itself. Below is a snippet of code > from my merged app where I think the error is happening. > > > int main( int argc, char **argv ) > { > int fd = -1; // file descriptor for the device that reads events > int simEvt; // loop counter for managing simultaneous events > size_t read_bytes; // how many bytes were read > struct input_event ev[64]; // the events (up to 64 at once) > > if ((fd = open("/dev/input/event0", O_RDONLY)) < 0) > { > perror("evdev open error"); > exit(1); > } > > // File desciptor for GPIO pins > int fd_gpio; > fd_gpio = open("/dev/mem", O_RDWR | O_SYNC); > > if (fd_gpio < 0) // checking successful open of file descriptor > { > perror("open(\"/dev/mem\")"); > exit(1); > } > > map = mmap(0, // memory mapping > MAP_SIZE, > PROT_READ | PROT_WRITE, > MAP_SHARED, > fd_gpio, > 0x40E00000 & ~MAP_MASK > ); > > if (map == (void*)-1 ) > { > perror("mmap()"); > exit(1); > } > > /* Set GPIO functions first - 14 sets of two pins each, soldered */ > /* Then set the direction - all are output */ > > gpio_function(92, GPIO); // mapping for pin 1 > gpio_function(117, GPIO); > gpio_direction(92, OUT); > gpio_direction(117, OUT); > > ... > ... > > gpio_function(57, GPIO); // mapping for pin 14 > gpio_function(83, GPIO); > gpio_direction(57, OUT); > gpio_direction(83, OUT); > > > // Initialize DirectFB Graphics > DFBCHECK (DirectFBInit (&argc, &argv)); > DFBCHECK (DirectFBCreate (&dfb)); > DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); > dsc.flags = DSDESC_CAPS; > dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING; > DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary )); > DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height)); > > // Draw the main (default) screen > //The draw() function just uses the same code as the DirectFB sample code > for drawing a .png image on the screen > draw(1); > > while(1) > // program is really a menu currently set to run indefinitely in a > loop > { > printf("Entered while(1) loop in main\n"); > > read_bytes = read(fd, ev, sizeof(struct input_event) * 64); > > if (read_bytes < (int) sizeof(struct input_event)) > { > perror("evtest: short read"); > exit (1); > } > printf("read in fd\n"); > > for (simEvt = 0; simEvt < (int) (read_bytes/sizeof(struct > input_event)); simEvt++) // processes simultaneous commands > ... > ... > > ---END of CODE SNIPPET > > The line where it seems to stop at is: > read_bytes = read(fd, ev, sizeof(struct input_event) * 64); > > I am pretty sure I have all the includes right and my code compiles, it > just doesn't acknowledge any mouse events. > > My thought is that Directfb masks my mouse events. Any logic to this? I > am hoping to demo my project on Monday will all the pieces working > together, so any suggestions are appreciated! > > Thanks, > > -SunitM > -- View this message in context: http://www.nabble.com/GPIO%2C-Mouse-Event0%2C-and-Directfb-not-playing-nicely-tp16214684p16217598.html Sent from the Gumstix mailing list archive at Nabble.com. |