Hi folks, i'm trying to use a PL-2303 based USB-to-RS232 adapter with
Linux 2.4.23-pre9 and am running in to a strange problem.


The system is a Mobile Pentium MMX with the ALi M1513 rev b3 chipset
(M5237 rev 03 USB controller).  The serial adapter is the only USB device
plugged in.


My test program opens the serial port and tries to write(2) every byte
from 0x00 to 0xFF, one at a time.


In the default (cooked) tty mode, when it comes time to write 0x09 or
0x0A, it blocks for a long time (tens of seconds), and then finally the
byte goes out on the wire and the write returns.  All the other bytes
before and after go through nice & quick.  (It doesnt matter where in the
ASCII list i start - it seems to only have trouble with 0x09 and 0x0A,
independent of order.)


With /dev/ttyUSB0 in cooked mode, the receiving side sees a modified byte
stream - the 0x0A gets replaced with to 0x0D.  If i switch it to raw mode
before running my test command, it works fine, all 256 bytes go through
promptly and unmolested.  So the problem seems to be an interaction with
the tty layer?


The cooked behavior of the PL-2303 is different than the cooked behavior
of the 16550 RS-232 port on the southbridge.  On the southbridge serial
port in cooked mode, all bytes go through quickly, the 0x09 is unchanged,
and the 0x0A is replaced by the two-byte sequence 0x0D 0x0A.


The raw mode of both the PL-2303 and the Southbridge serial ports are
the same - all bytes go through quickly and unchanged, as expected.




Here's the syslog of me loading the relevant modules (pl2303 debug=1):

    usb.c: registered new driver usbdevfs
    usb.c: registered new driver hub
    PCI: Found IRQ 9 for device 00:0f.0
    usb-ohci.c: USB OHCI at membase 0xc8828000, IRQ 9
    usb-ohci.c: usb-00:0f.0, ALi Corporation USB 1.1 Controller
    usb.c: new USB bus registered, assigned bus number 1
    hub.c: USB hub found
    hub.c: 2 ports detected
    hub.c: new USB device 00:0f.0-1, assigned address 2
    usb.c: USB device 2 (vend/prod 0x67b/0x2303) is not claimed by any active driver.
    usb.c: registered new driver serial
    usbserial.c: USB Serial support registered for Generic
    usbserial.c: USB Serial Driver core v1.4
    usbserial.c: USB Serial support registered for PL-2303
    usbserial.c: PL-2303 converter detected
    usbserial.c: PL-2303 converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
    pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.10




Here's running the test program in cooked mode on the PL-2303:

    pl2303.c: pl2303_open -  port 0
    pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 0
    pl2303.c: 0x40:0x1:0x404:0x0  0
    pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 0
    pl2303.c: 0xc0:0x1:0x8383:0x0  1 - 0
    pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 0
    pl2303.c: 0x40:0x1:0x404:0x1  0
    pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 0
    pl2303.c: 0xc0:0x1:0x8383:0x0  1 - 0
    pl2303.c: pl2303_set_termios -  port 0, initialized = 0
    pl2303.c: 0xa1:0x21:0:0  7 - 0 0 0 0 0 0 0
    pl2303.c: pl2303_set_termios - data bits = 8
    pl2303.c: pl2303_set_termios - baud = 9600
    pl2303.c: pl2303_set_termios - stop bits = 1
    pl2303.c: pl2303_set_termios - parity = none
    pl2303.c: 0x21:0x20:0:0  7
    pl2303.c: set_control_lines - value = 3, retval = 0
    pl2303.c: 0xa1:0x21:0:0  7 - 80 25 0 0 0 0 8
    pl2303.c: pl2303_open - submitting read urb
    pl2303.c: pl2303_open - submitting interrupt urb
    pl2303.c: pl2303_read_int_callback (0)
    pl2303.c: pl2303_read_int_callback - length = 10, data = a1 20 00 00 00 00 02 00 
83 00 
    pl2303.c: pl2303_ioctl (0) cmd = 0x5401
    pl2303.c: pl2303_ioctl not supported = 0x5401
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 00 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 01 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 02 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 03 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 04 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 05 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 06 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 07 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 08 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 0 bytes
    pl2303.c: pl2303_write - length = 0, data = 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 0 bytes
    pl2303.c: pl2303_write - length = 0, data = 
    pl2303.c: pl2303_write_bulk_callback - port 0

    These zero-length, no-data messages go on and on...  And then:

    pl2303.c: pl2303_write - port 0, 0 bytes
    pl2303.c: pl2303_write - length = 0, data = 
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 1 bytes
    pl2303.c: pl2303_write - length = 1, data = 09
    pl2303.c: pl2303_write_bulk_callback - port 0
    pl2303.c: pl2303_write - port 0, 0 bytes
    pl2303.c: pl2303_write - length = 0, data =
    pl2303.c: pl2303_write_bulk_callback - port 0


Then a bunch more of these zero-length messages, overwhelming my poor
syslog demon.  But eventually it seems to get the byte out (0x0D instead
of 0x0D 0x0A) and then everything after that works fine.




Ok that's all i know.  If you want me to run any other tests just let
me know.




--
Sebastian



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to