Re: [PATCH 1/3] Support for Quatech ESU2-100 USB 2.0 8-port serial adaptor

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

 



> +	if (old_termios) {
> +		if ((tty->termios->c_cflag == old_termios->c_cflag) &&
> +			(RELEVANT_IFLAG(tty->termios->c_iflag) ==
> +			RELEVANT_IFLAG(old_termios->c_iflag))) {
> +			dbg("%s(): Nothing to change", __func__);
> +			return;

That test needs tweaking - it would have worked historically but its no
longer valid.

if (old_termios && !tty_termios_hw_change(old_termios,&tty->termios))
	return;

> +	/* Parity stuff */
> +	if (tty->termios->c_cflag & PARENB) {
> +		if (tty->termios->c_cflag & PARODD)
> +			LCR_change_to |= QT2_SERIAL_ODD_PARITY;
> +		else
> +			LCR_change_to |= QT2_SERIAL_EVEN_PARITY;
> +	}
> +	if (tty->termios->c_cflag & CSTOPB)
> +		LCR_change_to |= QT2_SERIAL_TWO_STOPB;
> +	else
> +		LCR_change_to |= QT2_SERIAL_ONE_STOPB;

Looks good. As mark space isn't supported it should also do

	tty->termios->c_cflag &= ~CMSPAR;

> +	divisor = QT2_MAX_BAUD_RATE / baud;
> +	remainder = QT2_MAX_BAUD_RATE % baud;
> +	/* Round to nearest divisor */
> +	if (((remainder * 2) >= baud) && (baud != 110))
> +		divisor++;
>
> +	status = qt2_boxsetuart(serial, UartNumber, (unsigned short) divisor,
> +			    LCR_change_to);
> +	if (status < 0)	{
> +		dbg("qt2_boxsetuart() failed");
> +		return;

Should on succes then really work out the baud rate selected which I
assume is QT2_MAX_BAUD_RATE / divisor and call tty_encode_baud_rate(tty,
rate, rate);

> +	/* if we are implementing XON/XOFF, set the start and stop character
> +	 * in the device */
> +	if (I_IXOFF(tty) || I_IXON(tty)) {
> +		unsigned char stop_char  = STOP_CHAR(tty);
> +		unsigned char start_char = START_CHAR(tty);
> +		status = qt2_boxsetsw_flowctl(serial, UartNumber, stop_char,
> +				start_char);
> +		if (status < 0)
> +			dbg("qt2_boxsetsw_flowctl (enabled) failed");

Not sure what should happen here for IXANY but thats a minor detail

--
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