On Sat, Jan 05, 2008 at 02:09:32AM +0000, Alan Cox wrote: > > first segment reverted -> works OK > > first segment applied -> breaks > > So I would guess while data is being transferred your code sets the tty > settings to the exact ones that were still in use, and this now drops > bytes ?
Yes - as far as I can see, only VMIN and VTIME change between ioctl()s. I made two strace logs: * strace-OK with patch segment 1 backed out * strace-broken with patch segment 1 applied They are trimmed at the beginning and end, and select() calls were removed. I'll attach a diff between the two logs, with lots of context. Please let me know if you need anything further. Mirko
--- strace-OK 2008-01-06 00:26:29.000000000 +0100 +++ strace-broken 2008-01-06 00:26:44.000000000 +0100 @@ -1,55 +1,54 @@ open("/dev/ttyUSB0", O_RDWR|O_NOCTTY) = 3 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=255, c_cc="\x03\x1c\x7f\x15\x04\xff\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=255, c_cc="\x03\x1c\x7f\x15\x04\xff\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=255, c_cc="\x03\x1c\x7f\x15\x04\xff\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {c_iflags=0, c_oflags=0, c_cflags=0xcbc, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbc, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbc, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbc, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 write(3, "\240\242\0\3\273\0\0\0\273\260\263", 11) = 11 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=255, c_cc="\x03\x1c\x7f\x15\x04\xff\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0x1cb2, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=255, c_cc="\x03\x1c\x7f\x15\x04\xff\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0 read(3, "\240", 1) = 1 read(3, "\242", 1) = 1 read(3, "\6", 1) = 1 read(3, "\312", 1) = 1 read(3, "\273", 1) = 1 read(3, "\0", 1) = 1 read(3, "\220", 1) = 1 read(3, "\0", 1) = 1 read(3, "\220", 1) = 1 read(3, "\0", 1) = 1 read(3, "\2", 1) = 1 read(3, "{", 1) = 1 read(3, "\253", 1) = 1 read(3, "\0", 1) = 1 read(3, "\4", 1) = 1 read(3, "\277", 1) = 1 read(3, "\247", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\2", 1) = 1 read(3, "~", 1) = 1 read(3, "Z", 1) = 1 read(3, "\0", 1) = 1 read(3, "\4", 1) = 1 read(3, "\277", 1) = 1 read(3, "\247", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\0", 1) = 1 read(3, "\1", 1) = 1 read(3, "\0", 1) = 1 read(3, "\2", 1) = 1 read(3, "~", 1) = 1 -read(3, "\302", 1) = 1 -read(3, "\0", 1) = 1 +read(3, "\36", 1) = 1 read(3, "\4", 1) = 1 read(3, "\277", 1) = 1 read(3, "\247", 1) = 1