/* sw_guess_mode() checks the upper two button bits for toggling - indication of that the joystick is in 3-bit mode. This is documented behavior for 3DP ID packet, and for example the FSP does this in normal packets instead. Fun ...  */
static int sw_guess_mode(unsigned char *buf, int len)
/* sw_guess_mode() checks the upper two button bits for toggling - indication of that the joystick is in 3-bit mode. This is documented behavior for 3DP ID packet, and for example the FSP does this in normal packets instead. Fun ...  */
static int sw_guess_mode(unsigned char *buf, int len)
{
	int i;
	unsigned char xor = 0;
	for (i = 1; i < len; i++)
		xor |= (buf[i - 1] ^ buf[i]) & 6;
	return !!xor * 2 + 1;
}