Lines Matching refs:gameport

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