Lines Matching refs:gameport

15 #include <linux/gameport.h>
96 struct gameport *gameport;
116 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id)
123 timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID packet */
124 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */
125 start = gameport_time(gameport, SW_START);
126 strobe = gameport_time(gameport, SW_STROBE);
133 gameport_trigger(gameport); /* Trigger */
134 v = gameport_read(gameport);
139 v = gameport_read(gameport);
152 v = gameport_read(gameport);
168 gameport_trigger(gameport); /* Trigger */
221 static void sw_init_digital(struct gameport *gameport)
231 gameport_trigger(gameport); /* Trigger */
232 t = gameport_time(gameport, SW_TIMEOUT * 1000);
233 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */
237 gameport_trigger(gameport); /* Last trigger */
411 i = sw_read_packet(sw->gameport, buf, sw->length, 0);
417 " - going to reinitialize.\n", sw->gameport->phys);
443 " - enabling optimization again.\n", sw->gameport->phys);
456 " - disabling optimization.\n", sw->gameport->phys);
464 " - reinitializing joystick.\n", sw->gameport->phys);
468 sw_init_digital(sw->gameport);
472 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */
474 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */
481 static void sw_poll(struct gameport *gameport)
483 struct sw *sw = gameport_get_drvdata(gameport);
494 gameport_start_polling(sw->gameport);
502 gameport_stop_polling(sw->gameport);
567 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
588 sw->gameport = gameport;
590 gameport_set_drvdata(gameport, sw);
592 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
597 gameport->phys, gameport->io, gameport->speed);
599 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */
604 sw_init_digital(gameport); /* Switch to digital */
606 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
615 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */
621 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
629 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */
640 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */
648 sw->gameport = gameport;
702 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys);
714 gameport_set_poll_handler(gameport, sw_poll);
715 gameport_set_poll_interval(gameport, 20);
726 "%s/input%d", gameport->phys, i);
740 input_dev->dev.parent = &gameport->dev;
781 fail2: gameport_close(gameport);
782 fail1: gameport_set_drvdata(gameport, NULL);
787 static void sw_disconnect(struct gameport *gameport)
789 struct sw *sw = gameport_get_drvdata(gameport);
794 gameport_close(gameport);
795 gameport_set_drvdata(gameport, NULL);