Lines Matching refs:gameport
18 #include <linux/gameport.h>
99 struct gameport *gameport;
119 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id)
126 timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID packet */
127 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */
128 start = gameport_time(gameport, SW_START);
129 strobe = gameport_time(gameport, SW_STROBE);
136 gameport_trigger(gameport); /* Trigger */
137 v = gameport_read(gameport);
142 v = gameport_read(gameport);
155 v = gameport_read(gameport);
171 gameport_trigger(gameport); /* Trigger */
224 static void sw_init_digital(struct gameport *gameport)
234 gameport_trigger(gameport); /* Trigger */
235 t = gameport_time(gameport, SW_TIMEOUT * 1000);
236 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */
240 gameport_trigger(gameport); /* Last trigger */
414 i = sw_read_packet(sw->gameport, buf, sw->length, 0);
420 " - going to reinitialize.\n", sw->gameport->phys);
446 " - enabling optimization again.\n", sw->gameport->phys);
459 " - disabling optimization.\n", sw->gameport->phys);
467 " - reinitializing joystick.\n", sw->gameport->phys);
471 sw_init_digital(sw->gameport);
475 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */
477 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */
484 static void sw_poll(struct gameport *gameport)
486 struct sw *sw = gameport_get_drvdata(gameport);
497 gameport_start_polling(sw->gameport);
505 gameport_stop_polling(sw->gameport);
570 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
591 sw->gameport = gameport;
593 gameport_set_drvdata(gameport, sw);
595 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
600 gameport->phys, gameport->io, gameport->speed);
602 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */
607 sw_init_digital(gameport); /* Switch to digital */
609 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
618 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */
624 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
632 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */
643 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */
651 sw->gameport = gameport;
704 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys);
716 gameport_set_poll_handler(gameport, sw_poll);
717 gameport_set_poll_interval(gameport, 20);
728 "%s/input%d", gameport->phys, i);
742 input_dev->dev.parent = &gameport->dev;
783 fail2: gameport_close(gameport);
784 fail1: gameport_set_drvdata(gameport, NULL);
789 static void sw_disconnect(struct gameport *gameport)
791 struct sw *sw = gameport_get_drvdata(gameport);
796 gameport_close(gameport);
797 gameport_set_drvdata(gameport, NULL);