> > I have some issues with the usbsprl driver:
> >
> > 1. hardware flow ctl is always enabled
> >
> > I use only RX,TX and GND in my cable and peripheral
> hardware and cannot communicate via Prolific adapter
> because hw flow ctl appears to be always
> > enabled.
> > If I remove the following initialization code
> (which enables hw flow ctl for a
> > rev. H chip) from pl2303_open_hw_port(), my
> problems are gone:
> >
> >                 /* Set DCR0 */
> >                 if ((rval =
> pl2303_cmd_vendor_write0(plp, SET_DCR0,
> >                     DCR0_INIT_H)) != USB_SUCCESS) {
> >
> >                         return (rval);
> >                 }
> >   
> usbsprl driver is written according to Prolific's
> specification and its parameters configuration can
> satisfy most common devices. Current information is
> not enough to describe why it can't work with your
> special device.
> 

The reason why it can't work is because hardware flow control in the Prolific 
chip  is enabled when the port is opened, and there appears to be no code 
anywhere in the driver that allows hardware flow control to be disabled.

Looking at the Linux source code provided by Prolific, the DCR0 register is 
initialized with a value 0x01 upon port open and then 0x41 or 0x61 (depending 
on chip rev) is written to enable hw flow ctl.

My suggested change would be to add a function that disables hardware flow 
control. E.g.:

/*
 * Disable Hardware flow control
 */
static int
pl2303_cmd_clear_rtscts(pl2303_state_t *plp)
{

        return (pl2303_cmd_vendor_write0(plp, SET_DCR0, 0x01));
}

And then change the DS_PARAM_FLOW_CTL case in pl2303_set_port_params() to:

                case DS_PARAM_FLOW_CTL:
                        /* Hardware flow control */
                        if (pe->val.ui & CTSXON) {
                                if ((rval = pl2303_cmd_set_rtscts(plp))
                                    != USB_SUCCESS) {

                                        USB_DPRINTF_L3(DPRINT_CTLOP,
                                            plp->pl_lh,
                                            "pl2303_set_port_params: "
                                            "pl2303_cmd_set_rtscts failed");
                                }
                        }
                        else {
                                if ((rval = pl2303_cmd_clear_rtscts(plp))
                                    != USB_SUCCESS) {

                                        USB_DPRINTF_L3(DPRINT_CTLOP,
                                            plp->pl_lh,
                                            "pl2303_set_port_params: "
                                            "pl2303_cmd_clear_rtscts failed");
                                }
                        }

                        break;

That fixes it for me too.

Disabling hardware flow control in my opinion is not an exotic feature, so I 
would expect that to be supported by a serial driver. The manual page mentions 
that the driver "supports the  termio(7I)  device  control  functions", which 
is not true for the current driver.
There remains the issue of inbound and outbound hw flow control, which is not 
handled separately currently. But since I do not have the Prolific spec I do 
not know if it is supported at all and therefore cannot comment on that.

Marcel
-- 
This message posted from opensolaris.org

Reply via email to