On Tue, May 09, 2017 at 11:31:04AM +0200, Anthony Mallet wrote:
> On Monday  8 May 2017, at 17:38, Johan Hovold wrote:
> > You can read (and also change) the latency-timer value used through
> > sysfs:
> > 
> >     # cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer 
> >     16
> > 
> > if that's what you needed? But unless you change it, you can infer the
> > value to be either 16 (default) or 1 depending on if ASYNC_LOW_LATENCY
> > is set as indicated by TIOCGSERIAL.
> 
> Yes, but the sysfs path has a lots a drawbacks:
> 
>  - 666 permissions by default, so unprivileged users cannot change it

You said you wanted to read it, and an unprivileged user can now again
change it through ASYNC_LOW_LATENCY.

>  - if ASYNC_LOW_LATENCY is not set, the current latency value cannot
>    be infered (it could have been changed from the default, by e.g. a
>    udev rule).

True, but again you can read it through sysfs also after you (or udev)
have changed the default value.

>  - I don't know any way to guess the sysfs path from a tty device
>    path, at least not without requiring a lot of extra dependencies
>    and very linux-specific code. This is all the more complex if you
>    consider that the tty path can either be a pty, a ftdi_sio tty or
>    anything else provided that isatty(3) returns 1 ...

You can use libudev (or a custom implementation) to find out whether the
tty is an FTDI device with the latency_timer sysfs attribute.

Yes, this is all both Linux and FTDI specific (the async flags, sysfs,
the latency timer, etc).

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

Reply via email to