예제 #1
0
int
eloWaitAck(int fd)
{
    unsigned char packet[ELO_PACKET_SIZE];
    int i, nb_errors;

    if (eloWaitReply(ELO_ACK, packet, fd)) {
        for (i = 0, nb_errors = 0; i < 4; i++) {
            if (packet[2 + i] != '0') {
                nb_errors++;
            }
        }

        if (nb_errors != 0) {
#ifdef DEBUG_MOUSE
            fprintf(stderr,
                    "Elographics acknowledge packet reports %d errors\n",
                    nb_errors);
#endif
        }
        return 1;
    } else {
        return 0;
    }
}
예제 #2
0
/*	eloSendQuery --
*/
int eloSendQuery(unsigned char *request, unsigned char* reply, int fd) {
	int ok;

	if (eloSendPacket(request, fd)) {
		ok = eloWaitReply(toupper(request[1]), reply, fd);
		if (ok) {
			ok = eloWaitAck(fd);
		}
		return ok;
	}
	else {
		return 0;
	}
}