If I were trying to solve this, I would use strace(1) or truss(1) to see what tip is reading when it works and when it doesn't, and figure out how it's different between the two. Maybe it requires a short pause between the two, or requires them to be in two different read statements, or something; see what pattern of reads you get when it works, then dink with your program until you can get it to do the same thing.