/* magellan_crunch_nibbles() verifies that the bytes sent from the Magellan have correct upper nibbles for the lower ones, if not, the packet will be thrown away. It also strips these upper halves to simplify further processing.  */
static int magellan_crunch_nibbles(unsigned char *data, int count)
/* magellan_crunch_nibbles() verifies that the bytes sent from the Magellan have correct upper nibbles for the lower ones, if not, the packet will be thrown away. It also strips these upper halves to simplify further processing.  */
static int magellan_crunch_nibbles(unsigned char *data, int count)
{
	static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?";
	do {
		if (data[count] == nibbles[data[count] & 0xf])
			data[count] = data[count] & 0xf;
		else
			return -1;
	} while (--count);
	return 0;
}