FOUL!
You've edited the code you posted originally, without telling anyone you did it. Now I think I see the purpose of the for loop. Before you changed it, it would obviously not have worked as intended. It still looks wrong, but in a completely different way. Is it perhaps supposed to be this?
Code:
for ( x = 0 ; x < byteswaiting; x++ )
I don't believe you did it on purpose, but I feel like I've been tricked into quoting the modified line and commenting on it as if it were still the original.
So if I want to test this in an FRC competition project, I can just put it in the OperatorControl() function, right? And if I do that, it doesn't need the outer while(), right? I'll be trying this out first thing tomorrow when the team meets again.