| Re: [AD] EVDEV mouse driver |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
> I've made changes to the setup to be able to handle event mouse
Thanks. I have a few questions:
+ /* We try to open some of the most common devices. If at least on was
+ * opened, we continue detection */
+ retval = -1;
+ for (n=0; n<NUM_FD; n++) {
+ fd[n] = open(devices[n], O_RDONLY | O_NONBLOCK);
+ if (fd[n]!=-1) {
+ retval = 0;
+ }
+ }
You don't break on the first successful call to open: purposefully ?
+ /* Flush the files FIXME not alway flushed */
+ for (n=0; n<NUM_FD; n++) {
+ if (fd[n]!=-1) {
+ while (read(fd[n], buffer_array[n], PACKET_SIZE) > 0)
+ ;
+ }
}
Could you explain the FIXME ?
+ for (count = 0; count < buffer_size; ) {
+ for (n=0; n<NUM_FD; n++) {
+ if (fd[n]!=-1) {
+ int c = read(fd[n], buffer_array[n]+count_array[n],
PACKET_SIZE);
+ if (c>0) {
+ count_array[n] += c;
+ if (count_array[n]>count) {
+ for ( ; count!=count_array[n]; count++) {
+ vline(popup_bitmap2, l + count*w/buffer_size, t, b,
gui_mg_color);
+ blit(popup_bitmap2, screen, 0, 0, 0, 0, SCREEN_W,
SCREEN_H);
+ }
+ }
+ }
+ }
So acquiring is performed for each device...
+ buffer = NULL;
+ for (n=0; n<NUM_FD; n++) {
+ if (count_array[n]==count) {
+ buffer = buffer_array[n];
+ }
+ }
... and then only one record is kept ? What if this record isn't recognized
by any driver, while another one would have been if it had been processed ?
> Also, the event mouse driver now try several device files by default.
Applied with modifications (lmseev2.diff).
> The device file names and packet size are hard coded in the setup. Is it
> better to specify them in the drivers ?
No, the setup program should be able to drive the autodetection process on
its own.
> Some small fixes in setup.c: device file wasn't closed at the end of
> detect_mouse, drivers name aren't always initialized, correction in a
> message ("No drivers understand...").
Commited to both trunk and branch (setup.diff).
> I've also found that alert doesn't seem to scare the mouse. I didn't
> investigate.
I can't reproduce on my system (4.1.9 CVS w/ pthreads). Could you craft a
minimal testcase that exhibits the problem ?
--
Eric BotcazouAttachment:
p.tar.gz
Description: application/tgz
| Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |