Lines Matching refs:gameport
115 struct gameport *gameport; member
135 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id) in sw_read_packet() argument
142 …timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID pac… in sw_read_packet()
143 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */ in sw_read_packet()
144 start = gameport_time(gameport, SW_START); in sw_read_packet()
145 strobe = gameport_time(gameport, SW_STROBE); in sw_read_packet()
152 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
153 v = gameport_read(gameport); in sw_read_packet()
158 v = gameport_read(gameport); in sw_read_packet()
171 v = gameport_read(gameport); in sw_read_packet()
187 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
240 static void sw_init_digital(struct gameport *gameport) in sw_init_digital() argument
250 gameport_trigger(gameport); /* Trigger */ in sw_init_digital()
251 t = gameport_time(gameport, SW_TIMEOUT * 1000); in sw_init_digital()
252 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */ in sw_init_digital()
256 gameport_trigger(gameport); /* Last trigger */ in sw_init_digital()
430 i = sw_read_packet(sw->gameport, buf, sw->length, 0); in sw_read()
436 " - going to reinitialize.\n", sw->gameport->phys); in sw_read()
462 " - enabling optimization again.\n", sw->gameport->phys); in sw_read()
475 " - disabling optimization.\n", sw->gameport->phys); in sw_read()
483 " - reinitializing joystick.\n", sw->gameport->phys); in sw_read()
487 sw_init_digital(sw->gameport); in sw_read()
491 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */ in sw_read()
493 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */ in sw_read()
500 static void sw_poll(struct gameport *gameport) in sw_poll() argument
502 struct sw *sw = gameport_get_drvdata(gameport); in sw_poll()
513 gameport_start_polling(sw->gameport); in sw_open()
521 gameport_stop_polling(sw->gameport); in sw_close()
586 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) in sw_connect() argument
607 sw->gameport = gameport; in sw_connect()
609 gameport_set_drvdata(gameport, sw); in sw_connect()
611 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); in sw_connect()
616 gameport->phys, gameport->io, gameport->speed); in sw_connect()
618 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */ in sw_connect()
623 sw_init_digital(gameport); /* Switch to digital */ in sw_connect()
625 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
634 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */ in sw_connect()
640 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
648 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */ in sw_connect()
659 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */ in sw_connect()
667 sw->gameport = gameport; in sw_connect()
715 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys); in sw_connect()
727 gameport_set_poll_handler(gameport, sw_poll); in sw_connect()
728 gameport_set_poll_interval(gameport, 20); in sw_connect()
739 "%s/input%d", gameport->phys, i); in sw_connect()
753 input_dev->dev.parent = &gameport->dev; in sw_connect()
794 fail2: gameport_close(gameport); in sw_connect()
795 fail1: gameport_set_drvdata(gameport, NULL); in sw_connect()
800 static void sw_disconnect(struct gameport *gameport) in sw_disconnect() argument
802 struct sw *sw = gameport_get_drvdata(gameport); in sw_disconnect()
807 gameport_close(gameport); in sw_disconnect()
808 gameport_set_drvdata(gameport, NULL); in sw_disconnect()