The validity check in read_header() looks for:
h->direction == AM7XXX_DIRECTION_IN
When this is false (direction is _not_equal_ to AM7XXX_DIRECTION_IN) it
cannot be said for sure that the direction field value is going to
really be AM7XXX_DIRECTION_OUT, technically the device may have put
anything there.
So, just report what happens don't try to overguess.
ret = 0;
} else {
error(dev->ctx,
ret = 0;
} else {
error(dev->ctx,
- "Received a packet with direction AM7XXX_DIRECTION_OUT, weird!\n");
+ "Expected an AM7XXX_DIRECTION_IN packet, got one with direction = %d. Weird!\n",
+ h->direction);