/* Returns true if all multiport slot states appear valid.  */
static int slots_valid(struct grip_mp *grip)
/* Returns true if all multiport slot states appear valid.  */
static int slots_valid(struct grip_mp *grip)
{
	int flags, slot, invalid = 0, active = 0;
	flags = get_and_decode_packet(grip, 0);
	if (!(flags & IO_GOT_PACKET))
		return 0;
	for (slot = 0; slot < 4; slot++) {
		if (grip->port[slot]->mode == GRIP_MODE_RESET)
			invalid = 1;
		if (grip->port[slot]->mode != GRIP_MODE_NONE)
			active = 1;
	}
	if (!active)
		return (flags & IO_DONE) ? 1 : 0;
	return invalid ? 0 : 1;
}