Beispiel #1
0
/*
 * Handle putting the keyboard data received from the ADB into
 * an ADB event record.
 */
void
akbd_adbcomplete(caddr_t buffer, caddr_t data_area, int adb_command)
{
	adb_event_t event;
	struct akbd_softc *sc;
	int adbaddr;
#ifdef ADB_DEBUG
	int i;

	if (adb_debug)
		printf("adb: transaction completion\n");
#endif

	adbaddr = ADB_CMDADDR(adb_command);
	sc = (struct akbd_softc *)data_area;

	event.byte_count = buffer[0];
	memcpy(event.bytes, buffer + 1, event.byte_count);

#ifdef ADB_DEBUG
	if (adb_debug) {
		printf("akbd: from %d at %d (org %d) %d:", adbaddr,
		    sc->handler_id, sc->origaddr, buffer[0]);
		for (i = 1; i <= buffer[0]; i++)
			printf(" %x", buffer[i]);
		printf("\n");
	}
#endif

	if (sc->sc_wskbddev != NULL)
		akbd_processevent(sc, &event);
}
Beispiel #2
0
void 
adb_msa3_complete(void *buffer, void *data_area, int adb_command)
{
	adb_event_t event;
	ADBDataBlock adbdata;
	int adbaddr;
	int error;
#ifdef ADB_DEBUG
	int i;

	if (adb_debug)
		printf("adb: transaction completion\n");
#endif

	adbaddr = ADB_CMDADDR(adb_command);
	error = GetADBInfo(&adbdata, adbaddr);
#ifdef ADB_DEBUG
	if (adb_debug)
		printf("adb: GetADBInfo returned %d\n", error);
#endif

	event.addr = adbaddr;
	event.hand_id = ADBMS_MSA3;
	event.def_addr = (int)(adbdata.origADBAddr);
	event.byte_count = buffer[0];
	memcpy(event.bytes, buffer + 1, event.byte_count);

#ifdef ADB_DEBUG
	if (adb_debug) {
		printf("adb: from %d at %d (org %d) %d:",
		    event.addr, event.hand_id, event.def_addr, buffer[0]);
		for (i = 1; i <= buffer[0]; i++)
			printf(" %x", buffer[i]);
		printf("\n");
	}
#endif

	microtime(&event.timestamp);

	adb_processevent(&event);
}
Beispiel #3
0
void 
adb_mm_nonemp_complete(void *buffer, void *data_area, int adb_command)
{
	adb_event_t event;
	ADBDataBlock adbdata;
	int adbaddr;
	int error;

#ifdef ADB_DEBUG
	int i;

	if (adb_debug)
		printf("adb: transaction completion\n");
#endif

	adbaddr = ADB_CMDADDR(adb_command);
	error = GetADBInfo(&adbdata, adbaddr);
#ifdef ADB_DEBUG
	if (adb_debug)
		printf("adb: GetADBInfo returned %d\n", error);
#endif

#if 0
	printf("adb: from %d at %d (org %d) %d:", event.addr,
		event.hand_id, event.def_addr, buffer[0]);
	for (i = 1; i <= buffer[0]; i++)
		printf(" %x", buffer[i]);
	printf("\n");
#endif

	/* massage the data to look like EMP data */
	if ((buffer[3] & 0x04) == 0x04)
		buffer[1] &= 0x7f;
	else
		buffer[1] |= 0x80;
	if ((buffer[3] & 0x02) == 0x02)
		buffer[2] &= 0x7f;
	else
		buffer[2] |= 0x80;
	if ((buffer[3] & 0x01) == 0x01)
		buffer[3] = 0x00;
	else
		buffer[3] = 0x80;

	event.addr = adbaddr;
	event.hand_id = (int)(adbdata.devType);
	event.def_addr = (int)(adbdata.origADBAddr);
	event.byte_count = buffer[0];
	memcpy(event.bytes, buffer + 1, event.byte_count);

#ifdef ADB_DEBUG
	if (adb_debug) {
		printf("adb: from %d at %d (org %d) %d:", event.addr,
		    event.hand_id, event.def_addr, buffer[0]);
		for (i = 1; i <= buffer[0]; i++)
			printf(" %x", buffer[i]);
		printf("\n");
	}
#endif

	microtime(&event.timestamp);

	adb_processevent(&event);
}