Re: Regarding USB-Serial Device driver

From: Raju Rameshwar Uprade
Date: Fri Aug 20 2010 - 02:56:46 EST


Greg,
Sorry for including quotations in my email.

Oliver,
I see the superfluous data with usbmon also.

I have changed the pl2303_write(), according to my need.I enabled the RTS line before
the data transmission and after a delay of 5ms ,disabled the RTS lines for my MCM device
to respond.

static int pl2303_write(struct usb_serial_port *port, const unsigned char *buf,int count)
> {
> struct pl2303_private *priv = usb_get_serial_port_data(port);
> unsigned long flags;
> u8 control;
> dbg("%s - port %d, %d bytes", __func__, port->number, count);
>
> if (!count)
> return count;
>
> // Following code is included so that We can enable the RTS line to high before
data transmission
> // Tried writing a for loop here to loop the RTS line enable/disable , but
that also didn't work...
>
> spin_lock_irqsave(&priv->lock, flags);
> priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
> control = priv->line_control;
> spin_unlock_irqrestore(&priv->lock, flags);
> set_control_lines(port->serial->dev, control);
>
> spin_lock_irqsave(&priv->lock, flags);
> count = pl2303_buf_put(priv->buf, buf, count);
> spin_unlock_irqrestore(&priv->lock, flags);
>
> pl2303_send(port); // If I comment this , driver
dosen't work
>
> // Following code is included so that We can disable the RTS line to low after data
transmission..
> // mdelay plays an Important role here....
> mdelay(5);
> spin_lock_irqsave(&priv->lock, flags);
> // priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); // this doesn't work
here...
> priv->line_control = 0; // this work here.....
> control = priv->line_control;
> spin_unlock_irqrestore(&priv->lock, flags);
> set_control_lines(port->serial->dev,control);
>
> return count; // count is also very IMP b'coz it affect the device
driver's behaviour.....
> }


Thanks,
Raju
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/