Lines Matching refs:gameport
116 struct gameport *gameport; member
136 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id) in sw_read_packet() argument
143 …timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID pac… in sw_read_packet()
144 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */ in sw_read_packet()
145 start = gameport_time(gameport, SW_START); in sw_read_packet()
146 strobe = gameport_time(gameport, SW_STROBE); in sw_read_packet()
153 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
154 v = gameport_read(gameport); in sw_read_packet()
159 v = gameport_read(gameport); in sw_read_packet()
172 v = gameport_read(gameport); in sw_read_packet()
188 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
241 static void sw_init_digital(struct gameport *gameport) in sw_init_digital() argument
251 gameport_trigger(gameport); /* Trigger */ in sw_init_digital()
252 t = gameport_time(gameport, SW_TIMEOUT * 1000); in sw_init_digital()
253 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */ in sw_init_digital()
257 gameport_trigger(gameport); /* Last trigger */ in sw_init_digital()
431 i = sw_read_packet(sw->gameport, buf, sw->length, 0); in sw_read()
437 " - going to reinitialize.\n", sw->gameport->phys); in sw_read()
463 " - enabling optimization again.\n", sw->gameport->phys); in sw_read()
476 " - disabling optimization.\n", sw->gameport->phys); in sw_read()
484 " - reinitializing joystick.\n", sw->gameport->phys); in sw_read()
488 sw_init_digital(sw->gameport); in sw_read()
492 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */ in sw_read()
494 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */ in sw_read()
501 static void sw_poll(struct gameport *gameport) in sw_poll() argument
503 struct sw *sw = gameport_get_drvdata(gameport); in sw_poll()
514 gameport_start_polling(sw->gameport); in sw_open()
522 gameport_stop_polling(sw->gameport); in sw_close()
587 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) in sw_connect() argument
608 sw->gameport = gameport; in sw_connect()
610 gameport_set_drvdata(gameport, sw); in sw_connect()
612 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); in sw_connect()
617 gameport->phys, gameport->io, gameport->speed); in sw_connect()
619 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */ in sw_connect()
624 sw_init_digital(gameport); /* Switch to digital */ in sw_connect()
626 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
635 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */ in sw_connect()
641 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
649 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */ in sw_connect()
660 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */ in sw_connect()
668 sw->gameport = gameport; in sw_connect()
716 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys); in sw_connect()
728 gameport_set_poll_handler(gameport, sw_poll); in sw_connect()
729 gameport_set_poll_interval(gameport, 20); in sw_connect()
740 "%s/input%d", gameport->phys, i); in sw_connect()
754 input_dev->dev.parent = &gameport->dev; in sw_connect()
795 fail2: gameport_close(gameport); in sw_connect()
796 fail1: gameport_set_drvdata(gameport, NULL); in sw_connect()
801 static void sw_disconnect(struct gameport *gameport) in sw_disconnect() argument
803 struct sw *sw = gameport_get_drvdata(gameport); in sw_disconnect()
808 gameport_close(gameport); in sw_disconnect()
809 gameport_set_drvdata(gameport, NULL); in sw_disconnect()