/* Returns true if a valid digital packet was received, false otherwise.  */
static int dig_mode_start(struct gameport *gameport, u32 *packet)
/* Returns true if a valid digital packet was received, false otherwise.  */
static int dig_mode_start(struct gameport *gameport, u32 *packet)
{
	int i;
	int flags, tries = 0, bads = 0;
	for (i = 0; i < ARRAY_SIZE(init_seq); i++) {
		if (init_seq[i])
			gameport_trigger(gameport);
		udelay(GRIP_INIT_DELAY);
	}
	for (i = 0; i < 16; i++)
		udelay(GRIP_INIT_DELAY);
	while (tries < 64 && bads < 8) {
		flags = multiport_io(gameport, IO_RESET, 0x27, packet);
		if (flags & IO_MODE_FAST)
			return 1;
		if (flags & IO_RETRY)
			tries++;
		else
			bads++;
	}
	return 0;
}