[BUG] usb-serial / pl2302 corrupted receive
Hi Greg,
I tried to flash an AVR microcontroler via an USB to serial converter which
uses pl2302 driver. It didn't work, so I set up following test to reproduce
the bug:
I connected two pls2302 usb-serial converters to two different usb-ports
of my machine and connected them with a rs232-nullmodem cable to each
other.
Terminal1:
cat /dev/ttyUSB1
Terminal2:
while true; do echo 123456789012345678901234567890 > /dev/ttyUSB0 ; done
When both usb-serial converters are plugged in, the first few lines appear
correctly on Terminal1. Then I noticed two different bahaviors:
1) The lines on Terminal1 are corrupted like:
"1111111111111111111111123456789012345678901234567890"
2) The lines "123456789012345678901234567890" appear correctly on Terminal1
but when I kill the "cat" command and start it again, there's only one line
and then no output anymore.
I verified this behavior on two different machines running the same
kernel (version 2.6.32.9).
Additionally a calltrace is printed to dmesg (see end of mail)
I'm not 100% sure, but if I remember correctly was flashing AVR
microcontrollers with pl2302 possible about the time when kernel 2.6.22 was
released.
If you've got any questions I'd be pleased to help you.
best regards,
--peter;
---
[piie@deskpiie ~]$ lsusb
Bus 002 Device 013: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial
Port
Bus 002 Device 012: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial
Port
------------[ cut here ]------------
WARNING: at drivers/usb/serial/usb-serial.c:406 serial_write_room+0x74/0x80
[usbserial]()
Hardware name: To Be Filled By O.E.M.
Modules linked in: pl2303 usbserial sha256_generic aes_i586 aes_generic cbc
ipv6 snd_hda_codec_nvhdmi usbhid hid snd_hda_codec_via snd_seq_dummy
snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss
snd_mixer_oss snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer
ohci_hcd snd soundcore coretemp snd_page_alloc nvidia(P) shpchp i2c_nforce2
ehci_hcd agpgart wmi psmouse thermal pci_hotplug i2c_core usbcore sg
forcedeth button processor serio_raw vboxdrv evdev dm_crypt dm_mod fuse
rtc_cmos rtc_core rtc_lib ext4 mbcache jbd2 crc16 sr_mod cdrom sd_mod
pata_acpi ahci ata_generic libata scsi_mod
Pid: 15, comm: events/0 Tainted: P W 2.6.32-ARCH #1
Call Trace:
[] ? warn_slowpath_common+0x6e/0xb0
[] ? serial_write_room+0x74/0x80 [usbserial]
[] ? warn_slowpath_null+0x13/0x20
[] ? serial_write_room+0x74/0x80 [usbserial]
[] ? tty_write_room+0x15/0x20
[] ? process_echoes+0x47/0x2b0
[] ? n_tty_receive_buf+0xe45/0x10c0
[] ? __switch_to+0x184/0x190
[] ? finish_task_switch+0x3b/0xa0
[] ? schedule+0x2f9/0xa30
[] ? usb_autopm_do_interface+0x7a/0xe0 [usbcore]
[] ? flush_to_ldisc+0x14a/0x180
[] ? flush_to_ldisc+0x0/0x180
[] ? worker_thread+0x11f/0x260
[] ? autoremove_wake_function+0x0/0x40
[] ? worker_thread+0x0/0x260
[] ? kthread+0x74/0x80
[] ? kthread+0x0/0x80
[] ? kernel_thread_helper+0x7/0x10
---[ end trace 4162a861717078f5 ]---
------------[ cut here ]------------
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Login to post comments
[BUG] usb-serial / pl2302 corrupted receive
Hi Greg,
Quoting Greg KH :
> On Mon, Mar 01, 2010 at 07:07:00PM +0100, Peter Feuerer wrote:
>> I connected two pls2302 usb-serial converters to two different
>> usb-ports of my machine and connected them with a rs232-nullmodem
>> cable to each other.
>>
>> Terminal1:
>> cat /dev/ttyUSB1
>>
>> Terminal2:
>> while true; do echo 123456789012345678901234567890 > /dev/ttyUSB0 ; done
>
> cat and echo are known to not work well with usb to serial devices. Can
> you duplicate this with a "real" tty program like minicom or something
> else?
I will try to set up a test use-case which uses kermit.
But there is a calltrace in kernel log when using cat & echo, so
something in the driver went wrong.
Thus there is a bug which can be reproduced and it should be fixed,
don't you agree?
best regards,
--peter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[BUG] usb-serial / pl2302 corrupted receive
On Wed, Mar 03, 2010 at 11:47:05AM +0100, peter@piie.net wrote:
> Quoting Greg KH :
> > On Mon, Mar 01, 2010 at 07:07:00PM +0100, Peter Feuerer wrote:
> >> I connected two pls2302 usb-serial converters to two different
> >> usb-ports of my machine and connected them with a rs232-nullmodem
> >> cable to each other.
> >>
> >> Terminal1:
> >> cat /dev/ttyUSB1
> >>
> >> Terminal2:
> >> while true; do echo 123456789012345678901234567890 > /dev/ttyUSB0 ; done
> >
> > cat and echo are known to not work well with usb to serial devices. Can
> > you duplicate this with a "real" tty program like minicom or something
> > else?
>
> I will try to set up a test use-case which uses kermit.
>
> But there is a calltrace in kernel log when using cat & echo, so
> something in the driver went wrong.
> Thus there is a bug which can be reproduced and it should be fixed,
> don't you agree?
Not necessarily. The warning you attached to your first post is a false
one (it has been fixed in 2.6.33) and is not directly related to the
problem you describe.
/Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[BUG] usb-serial / pl2302 corrupted receive
> > Terminal1:
> > cat /dev/ttyUSB1
> >
> > Terminal2:
> > while true; do echo 123456789012345678901234567890 > /dev/ttyUSB0 ; done
>
> cat and echo are known to not work well with usb to serial devices. Can
> you duplicate this with a "real" tty program like minicom or something
> else?
That should no longer be the case. The kfifo buffering implementation
fixed all the broken internal buffering in the usb tty code - or should
have done.
Definitely worthy of more investigation if the second open/closes are
disrupting stuff.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[BUG] usb-serial / pl2302 corrupted receive
On Wed, Mar 03, 2010 at 12:14:41PM +0000, Alan Cox wrote:
> > > Terminal1:
> > > cat /dev/ttyUSB1
> > >
> > > Terminal2:
> > > while true; do echo 123456789012345678901234567890 > /dev/ttyUSB0 ; done
> >
> > cat and echo are known to not work well with usb to serial devices. Can
> > you duplicate this with a "real" tty program like minicom or something
> > else?
>
> That should no longer be the case. The kfifo buffering implementation
> fixed all the broken internal buffering in the usb tty code - or should
> have done.
Actually, the per-bulk-out-point allocated kfifo is currently unsused for most
drivers, including the pl2303.
I'm responding to this mail with a patch (against 2.6.33) which replaces
the custom fifo-based write implementation in pl2303 with the generic
kfifo based one. I've used it for quite a while now without any problems
(just haven't got around to submitting it).
If Alan's correct, this might solve the echo/cat issue, but either way
it should be applied at some point as it removes a lot of duplicate code.
/Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/