ethercat/tty
Thomas Petazzoni 27175946c4 tty/module.c: fix ec_tty_write() prototype for Linux >= 6.6
In upstream Linux kernel commits:
 95713967ba52389f7cea75704d0cf048080ec218 ("tty: make tty_operations::write()'s count size_t")
 69851e4ab8feeb369119a44ddca430c0ee15f0d8 ("tty: propagate u8 data to tty_operations::write()")

The prototype of tty_operations->write() was changed from:

       int  (*write)(struct tty_struct * tty,
                     const unsigned char *buf, int count);

to:

       ssize_t (*write)(struct tty_struct *tty, const u8 *buf, size_t count);

Both of those commits were merged in Linux 6.6, and this needs an
update in tty/module.c to avoid the following build failure:

/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:740:14: error: initialization of "ssize_t (*)(struct tty_struct *, const u8 *, size_t)" {aka "long int (*)(struct tty_struct *, const unsigned char *, long unsigned int)"} from incompatible pointer type "int (*)(struct tty_struct *, const unsigned char *, int)" [-Werror=incompatible-pointer-types]
  740 |     .write = ec_tty_write,
      |              ^~~~~~~~~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-12-31 10:42:49 +01:00
..
Kbuild.in Fixed mail address; limited lines to 78 characters; removed $Id$. 2024-02-01 15:15:41 +01:00
Makefile.am Fixed mail address; limited lines to 78 characters; removed $Id$. 2024-02-01 15:15:41 +01:00
README Fixed mail address; limited lines to 78 characters; removed $Id$. 2024-02-01 15:15:41 +01:00
module.c tty/module.c: fix ec_tty_write() prototype for Linux >= 6.6 2024-12-31 10:42:49 +01:00

README

vim700: spelllang=en spell

Virtual TTY interface driver for EtherCAT slave supporting serial comm

Quick installation guide:

./configure --with-linux-dir=/your/linux/directory --enable-tty
make all modules
make modules_install install
rcethercat start
insmod tty/ec_tty.ko
insmod examples/tty/ec_tty_example.ko

The default settings for the serial line are 9600 8 N 1.

The tty example operates a Beckhoff EL6002 at ring position 1. For a short
test, connect port X1 with a serial port via null modem cable. If a minicom is
started on that port and the below command is entered, the output should be
visible in minicom:

echo "Hello World" > /dev/ttyEC0

Have a lot of fun!