[PATCH] Documentation about RS485 serial communications

Chris Down chris at alcor.co.uk
Thu Oct 28 11:10:17 EDT 2010


Just a minor issue.

On 24/10/2010 12:29, Claudio Scordino wrote:
> +4. USAGE FROM USER-LEVEL
> +
> +   From user-level, RS485 configuration can be get/set using the previous
> +   ioctls. For instance, to set RS485 you can use the following code:
> +
> +	#include <linux/serial.h>
> +
> +	/* Driver-specific ioctls: */
> +	#define TIOCGRS485      0x542E
> +	#define TIOCSRS485      0x542F
> +
> +	/* Open your specific device (e.g., /dev/mydevice): */
> +	int fd = open ("/dev/mydevice", O_RDWR);
> +	if (fd < 0) {
> +		/* Error handling. See errno. */
> +	}
> +
> +	struct serial_rs485 rs485conf;
> +
> +	/* Set RS485 mode: */
> +	rs485conf.flags |= SER_RS485_ENABLED;
> +
> +	/* Set rts delay before send, if needed: */
This comment is misleading as the delay must be set regardless.
If it is not used it should be set to 0.

> +	rs485conf.flags |= SER_RS485_RTS_BEFORE_SEND;
> +	rs485conf.delay_rts_before_send = ...;
> +
> +	/* Set rts delay after send, if needed: */
The same applies here.

> +	rs485conf.flags |= SER_RS485_RTS_AFTER_SEND;
> +	rs485conf.delay_rts_after_send = ...;

Chris



More information about the linux-arm-kernel mailing list