Re: Pl2303 usb-serial adapter receives but does not transmit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm on a recent 3.2 kernel.
These are my settings reported by the 'stty -a -F /dev/ttyUSB0' command:


# before launching minicom, power unplugged from the router:
n53-sabayon ~/dev/hacking/alice-stb # stty -a -F /dev/ttyUSB0
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S;
susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke




#after minicom has been launched, power unplugged from the router:
n53-sabayon ~/dev/hacking/alice-stb # stty -a -F /dev/ttyUSB0
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S;
susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke


I'm using these settings for minicom:

serial port
A -    Serial Device      : /dev/ttyUSB0
E -    Bps/Par/Bits       : 115200 8N1
F - Hardware Flow Control : No
G - Software Flow Control : No

modem and dialing parameters setup
DTR drop time: 0
Auto bps detect: No
Modem has DCD line: No

Terminal settings
Terminal emulation: VT102
Backspace key sends: DEL
Status line is: enabled
Newline delay (ms): 0


With these settings, I'm able to receive the initalization strings
sent by the router:

The procedure I follow to connect to the tty is:

1. modprobe -r pl2303
2. modprobe -r usbserial
3. <plug in the ca-42 cable and wait 3 seconds>
4. minicom
5. <plug the power chord into the router>
6. <text from router flows into minicom. the router stands by for 10 seconds
   listening for a BREAK>
7. I send the break command through minicom (CTRL+A, F)
8. Yamon prompts appear waiting for commands


 After the first BREAK, no other textual commands get received by the
 router (seems that additional break commands get sent actuallly, but I
 cannot verify this because yamon does not respond to break command
 when in prompt mode).


I'm absolutely not an expert with UART an RS232 communication, but
looking at the code I've seen that break commands are sent using
this function:

static void pl2303_break_ctl(struct tty_struct *tty, int break_state)
{
       struct usb_serial_port *port = tty->driver_data;
       struct usb_serial *serial = port->serial;
       u16 state;
       int result;

       dbg("%s - port %d", __func__, port->number);

       if (break_state == 0)
               state = BREAK_OFF;
       else
               state = BREAK_ON;
       dbg("%s - turning break %s", __func__,
                       state == BREAK_OFF ? "off" : "on");

       result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
                                BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
                                0, NULL, 0, 100);
       if (result)
               dbg("%s - error sending break = %d", __func__, result);
}



Since I don't read any "error sending break" in my logs, is it correct to assume
that the transmission channel (from PC to the router) actually works?

Can I use usb_control_msg() to send data other than BREAK command?



2012/2/9 Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>:
> On Thu, Feb 09, 2012 at 08:03:24PM +0100, pierigno wrote:
>> googling a bit more about the problem, I've found that this is a common
>> misbehaviour of some faulty hardware. In an "ancient" mail dated 2005
>> greg asked for the output of /proc/bus/usb/devices/ , so here is mine:
>>
>> T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 10 Spd=12   MxCh= 0
>> D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
>> P:  Vendor=067b ProdID=2303 Rev= 3.00
>> S:  Manufacturer=Prolific Technology Inc.
>> S:  Product=USB-Serial Controller
>> C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
>> I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=pl2303
>> E:  Ad=81(I) Atr=03(Int.) MxPS=  10 Ivl=1ms
>> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
>> E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
>
> What kernel version are you having problems with?
>
> And are you sure the line settings are correct?  Flow control?  What
> program are you using talk to the device?
>
>> 2012/2/8 pierigno <pierigno@xxxxxxxxx>:
>> > hello,
>> >
>> > following mr Greg's bot advice, I'm sending this email tore you,
>> > hoping to get more insight on this matter.
>> >
>> >
>> > I'm having some problems trying to communicate with a home router
>> > device using a PL2303 based usb-to-serial converter.
>> >
>> > My linux-based router exposes a UART interface (with TTL levels,
>> > 155200 baud rate, 8N1, no hardware flow control) trough which is
>> > possible to visualize its initialization output and possibly interact
>> > with the built-in boot manager (yamon). So far,sadly, I was only able
>> > to receive the output sent by the device, but nothing more: any attept
>> > to send commands failed. Actually I'm able to see what I transmit only
>> > if I short-circuit TX and RX (leaving GND connected), so the wiring
>> > should be correct (Actually while gathering logs, I've found that if I
>> > detach the adapter, then reattach it again, I can actually send a
>> > break signal (through Control+A F sequence in minicom). After that
>> > however, I cannot send data anymore).
>> >
>> > I've tried many different programs, minicom, putty,gtkterm, screen,
>> > but the behaviour seems the same.
>> >
>> > I've gathered some logs with usbserial and pl2303 modules loaded with
>> > debug=1 and have attached them to this email:
>> >
>> >    - pl2303-usb.txt is output of lsusb -vvv
>> >    - usbserial-pl2303.log is the output of 'cat /var/log/messages'
>> >    - minicom-strace is the output of 'strace -o minicom-strace minicom'
>> >    - minicom-capture.log is the text coming from the router as captured
>> >     by minicom
>
> I don't see any of these files here :(
>
> It sounds like your device is broken, can you reproduce this with other
> devices?  All the ones I have here work fine...
>
> thanks,
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux