comparison src/video/fbcon/SDL_fbevents.c @ 4:4f6c5f021323

Date: Thu, 26 Apr 2001 10:46:23 +0200 From: Alexander Pipelka <pipelka@bms-austria.com> Subject: SDL ELO driver bugfix Hi Sam! We noticed that the ELO serial touchscreen controller is quite sensitive in terms of correct protocol handling. The current implementation cause some controllers to hangup after some time (> 24h). I think the attached patch should fix this (I ran my device more than 3 days without any hangups).
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:54:56 +0000
parents 74212992fb08
children b685c94f8db7
comparison
equal deleted inserted replaced
3:3b97b708523c 4:4f6c5f021323
617 617
618 int i, nread; 618 int i, nread;
619 int button = 0; 619 int button = 0;
620 int dx = 0, dy = 0; 620 int dx = 0, dy = 0;
621 int packetsize = 0; 621 int packetsize = 0;
622 622 int realx, realy;
623
623 /* Figure out the mouse packet size */ 624 /* Figure out the mouse packet size */
624 switch (mouse_drv) { 625 switch (mouse_drv) {
625 case MOUSE_NONE: 626 case MOUSE_NONE:
626 /* Ack! */ 627 /* Ack! */
627 read(mouse_fd, mousebuf, BUFSIZ); 628 read(mouse_fd, mousebuf, BUFSIZ);
645 /* Uh oh.. */ 646 /* Uh oh.. */
646 packetsize = 0; 647 packetsize = 0;
647 break; 648 break;
648 } 649 }
649 650
651 /* Special handling for the quite sensitive ELO controller */
652 if (mouse_drv == MOUSE_ELO) {
653
654 /* try to read the next packet */
655 if(eloReadPosition(this, mouse_fd, &dx, &dy, &button, &realx, &realy)) {
656 button = (button & 0x01) << 2;
657 FB_vgamousecallback(button, relative, dx, dy);
658 }
659
660 return;
661 }
662
650 /* Read as many packets as possible */ 663 /* Read as many packets as possible */
651 nread = read(mouse_fd, &mousebuf[start], BUFSIZ-start); 664 nread = read(mouse_fd, &mousebuf[start], BUFSIZ-start);
652 if ( nread < 0 ) { 665 if ( nread < 0 ) {
653 return; 666 return;
654 } 667 }
738 /* Get current mouse state */ 751 /* Get current mouse state */
739 button = (~mousebuf[i]) & 0x07; 752 button = (~mousebuf[i]) & 0x07;
740 dx = (signed char)mousebuf[i+1]; 753 dx = (signed char)mousebuf[i+1];
741 dy = -(signed char)mousebuf[i+2]; 754 dy = -(signed char)mousebuf[i+2];
742 break; 755 break;
756 /*
743 case MOUSE_ELO: 757 case MOUSE_ELO:
744 /* ELO protocol has ELO_START_BYTE as first byte */
745 if ( mousebuf[i] != ELO_START_BYTE ) { 758 if ( mousebuf[i] != ELO_START_BYTE ) {
746 /* Go to next byte */
747 i -= (packetsize-1); 759 i -= (packetsize-1);
748 continue; 760 continue;
749 } 761 }
750 762
751 /* parse the packet */
752 if(!eloParsePacket(&(mousebuf[i]), &dx, &dy, &button)) { 763 if(!eloParsePacket(&(mousebuf[i]), &dx, &dy, &button)) {
753 break; 764 i -= (packetsize-1);
765 continue;
754 } 766 }
755 767
756 button = (button & 0x01) << 2; 768 button = (button & 0x01) << 2;
757 769
758 /* convert to screen coordinates */
759 eloConvertXY(this, &dx, &dy); 770 eloConvertXY(this, &dx, &dy);
760 break; 771 break;
761 772 */
773
774 case MOUSE_ELO:
762 case NUM_MOUSE_DRVS: 775 case NUM_MOUSE_DRVS:
763 /* Uh oh.. */ 776 /* Uh oh.. */
764 dx = 0; 777 dx = 0;
765 dy = 0; 778 dy = 0;
766 break; 779 break;