Re: [PATCH V2] serial: Add ioctl to enable auto rs485 mode with some Exar UARTs

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

 



On Fri, 2009-01-02 at 17:26 +0100, Matthias Fuchs wrote:
> Some Exar UARTs support a auto rs485 mode. In this mode
> the UART's RTS# pin is activated during transmitting and
> can be used to enable a rs485 line driver.
 --->8----

> +
> +	case TIOCGRS485:
> +	{
> +		struct serial_rs485 rs485ctrl;

Should the TIOCGRS485 call set delay_rts_before_send structure element
to 0 to demonstrate that there is no delay ability?  memset(&rs485ctrl,
0, sizeof(struct serial_rs485)); missing?

> +
> +		if (port->type != PORT_16850)
> +			return -ENOTTY;
> +
> +		spin_lock_irqsave(&up->port.lock, flags);
> +		serial_outp(up, UART_LCR, 0xbf);
> +		if (serial_inp(up, UART_FCTR) & UART_FCTR_RS485)
> +			rs485ctrl.flags = SER_RS485_ENABLED;
> +		else
> +			rs485ctrl.flags = 0;
> +		serial_outp(up, UART_LCR, 0);
> +		spin_unlock_irqrestore(&up->port.lock, flags);
> +
> +		if (copy_to_user((struct serial_rs485 *)arg,
> +				 &rs485ctrl,
> +				 sizeof(rs485ctrl)))
> +			return -EFAULT;
> +		return 0;
> +	}

-- 
Christopher Gibson <chris@xxxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux