On 13 April 2010 11:45, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote: > +static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base, > u32 *actual, u8 parity) > { > int status; > + u32 baud; > u8 *dataout; > u8 DataCount = 0; > u8 T1Frekvens = 0; > @@ -865,6 +872,8 @@ > > if (!dataout) > return -ENOMEM; > + /*baud = (((priv->clk / 35) * baud_base) / 100000); */ > + baud = baud_base; > > > I'm a bit confused why you create an extra variable here ? It was initially for added readability. As you can see, the commented out line makes an adjustment to the baud rate, so I wanted to make it clear that the rate applied to the hardware was not necessarily the same as the function entry value. I failed to get this working reliably, so currently the two rates are the same. I would like to leave it in, so that if I do get the equation right, the change would be a single line patch. > > > + /* Just use the ospeed. ispeed should be the same. */ > + baud = tty->termios->c_ospeed; > > > ispeed and ospeed may be different. Prefering the ospeed if you can't set > them separately is expected so just fine and they will get written back > correctly by the encode_baud_rate call Ok. So I don't need to change anything there? > > int result; > + int baud = 9600; /* Fixed for the moment */ > u32 actual; > struct iuu_private *priv = usb_get_serial_port_data(port); > > The expected behaviour on open is to use the termios baud rate so now > you've allowed it to be set this should be using tty->termios as well > (and if need be forcing a default when the port is registered) I will modify the driver to do this. My understanding of tty is not 100%. It just so happens, that in the user land application I am using, the device is opened with a baud of 9600, so I guess my code works just out of co-incidence! I will test that everything still works after the change, and submit a new patch. > > +static int iuu_ioctl(struct tty_struct *tty, struct file *file, > + unsigned int cmd, unsigned long arg) > +{ > + dbg("%s cmd 0x%04x", __func__, cmd); > + > + /* Old interface. Returning -ENOIOCTLCMD for proper termios use. > */ > + return -ENOIOCTLCMD; > +} > > This should not be needed - its the default behaviour Strange, without this bit, my iuu_set_termios() is never called, and none of the baud rate functionality works. Are you sure that the return value of -ENOIOCTLCMD is the normal behaviour? I agree that is looks to be, but in practice it did not seem to work. From: usb-serial.c, is seems that without this function in my driver, the usb-serial.c should return -ENOIOCTLCMD. static int serial_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; int retval = -ENODEV; dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); WARN_ON(!port->port.count); /* pass on to the driver specific version of this function if it is available */ if (port->serial->type->ioctl) { retval = port->serial->type->ioctl(tty, file, cmd, arg); } else retval = -ENOIOCTLCMD; return retval; } Kind Regards James -- 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