All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Stuart Longland
	<stuartl-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org>
Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alan Cox
	<gnomes-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
Subject: Re: Moxa UPort 1150 and RS-422/485… what's the "proper" way to switch modes
Date: Tue, 27 Jun 2017 11:04:49 +0200	[thread overview]
Message-ID: <20170627090449.GG3025@localhost> (raw)
In-Reply-To: <4a469222-d48d-f498-f2db-ca582295adc3-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org>

[ +CC: Alan and linux-usb ]

On Fri, Jun 23, 2017 at 09:44:31AM +1000, Stuart Longland wrote:
> Hi all,
> 
> A silly question: I have a Moxa UPort 1150 USB serial interface that I
> am trying to coax into either RS-422 or 4-wire RS-485 mode.  Internally,
> this is a TI USB 3410 device, and works with the ti_usb_3410_5052 module.
> 
> Moxa have a (poorly maintained as usual) driver for these devices, and I
> see reference to things like RS-485 in the TI driver.  Moxa's driver did
> a kludge where they used `setserial` to control the mode, and used the
> device "port" number to set that mode.  I do not think it wise to try
> and replicate that same kludge, as I understand that parameter is for
> configuring the I/O port (e.g. 0x3f8 for /dev/ttyS0 on older
> IBM-compatibles).

Agreed, and that's why we have rejected this interface when support for
Moxa devices have been added.

> Now, *some* versions of `stty` allegedly have an "rs485" option: mine
> (in coreutils 8.25) does not.  I suspect this is 2-wire RS-485, which
> won't do here, as my RX and TX are on different RS-485 pairs.

Neither does mine, I think that's some out-of-tree support for the
TIOCSRS485 ioctl mentioned below.

> What's the "proper" way to configure such ports for RS-422 and/or 4-wire
> RS-485?  Is there an example driver in the tree that I can use as a
> guide to porting Moxa's mode-switch code over to the ti_usb_3410_5052
> driver?

I'm afraid not. We have the TIOCSRS485 ioctl, but that doesn't really
fit here (currently) as we're not just enabling 2-wire-rs485 style
signalling (using RTS to control the tranceiver), but are also
configuring the electrical interface (e.g. which pins on the DB9
connector are being used for which functions).

This question is raised every now and then; typically when a new
driver is being merged (e.g. mxuport or when support for your device was
added), but we have yet to decide on the proper interface.

Extending the TIOCSRS485 ioctl has been discussed, and one alternative
could be a sysfs-based interface as this would typically be something
you'd want to configure at boot and before opening the device (and
toggling DTR).

Either way, we need do determine the right level of abstraction as some
of the related properties are fairly device dependent (master/slave
mode, terminating resistors, auto direction, echo, etc).

For the record, note that we do have the mxser driver, and a few more
old drivers, implementing custom ioctls for this, but we really should
not be adding more of those.

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

       reply	other threads:[~2017-06-27  9:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4a469222-d48d-f498-f2db-ca582295adc3@longlandclan.id.au>
     [not found] ` <4a469222-d48d-f498-f2db-ca582295adc3-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org>
2017-06-27  9:04   ` Johan Hovold [this message]
2017-06-27  9:43     ` Moxa UPort 1150 and RS-422/485… what's the "proper" way to switch modes Stuart Longland
     [not found]       ` <42601356-656d-57d0-d366-a0933780b8f9-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org>
2017-06-27 12:08         ` Oliver Neukum
     [not found]           ` <1498565331.30390.5.camel-IBi9RG/b67k@public.gmane.org>
2017-06-27 22:07             ` Stuart Longland
     [not found]               ` <ae2907c2-cb0f-61e4-c6f2-af3dcec93ace-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org>
2017-06-28  9:19                 ` Oliver Neukum
     [not found]                   ` <1498641549.10278.5.camel-IBi9RG/b67k@public.gmane.org>
2017-06-28 12:01                     ` Greg KH
     [not found]                       ` <20170628120120.GA10502-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2017-06-28 12:41                         ` Oliver Neukum
     [not found]                           ` <1498653709.10278.17.camel-IBi9RG/b67k@public.gmane.org>
2017-06-28 14:59                             ` Bjørn Mork
2017-06-28 15:35                 ` Johan Hovold
2017-06-28 15:34             ` Johan Hovold
2017-06-29 19:50               ` Alan Cox
2017-07-03  8:51                 ` Johan Hovold
2017-06-28 15:16         ` Johan Hovold
2017-08-18  2:56   ` [PATCH] USB: serial: ti_usb_3410_5052: Port uart_mode from io_ti Stuart Longland
     [not found]     ` <20170818025659.4402-1-stuartl-EoQOJlg3kTYQrrorzV6ljw@public.gmane.org>
2017-08-18  3:16       ` Stuart Longland
2017-08-19 20:40       ` Maksim Salau
     [not found]         ` <20170819234056.37c7d339-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 20:47           ` Stuart Longland
2017-08-28  8:56       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170627090449.GG3025@localhost \
    --to=johan-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=gnomes-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
    --cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stuartl-3e+Fe6x+DsgJbe36r25VNhCuuivNXqWP@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.