Giter Club home page Giter Club logo

vtty's People

Contributors

anszom avatar christianrauch avatar dimich-dmb avatar dmsc avatar joluxer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vtty's Issues

baud rate on ttyV0 device

Hello,

I was trying out your driver to use it with a gps using gpsd, and another serial device, so I can choose which data gets sent to a real serial device port. The baudrate of the serial device, in my case called /dev/ttyTHS1 is 9600 baud. So now I mirror the port into ttyV0 and ttyV1. If I let gpsd connect to the "fake" serial port ttyV0, it autodetects that V0 is 38400 baud. The original ttyTHS1 port is 9600 when I start the mirror program. How can I force ttyV0 to return 9600 baud?

Best regards

cannot install module

Running make successfully builds the module /vtty.ko, but installing via make modules_install fails:

$ sudo make modules_install 
make -C /lib/modules/6.2.0-32-generic/build M= modules
make[1]: Verzeichnis „/usr/src/linux-headers-6.2.0-32-generic“ wird betreten
make[2]: *** Keine Regel vorhanden, um das Ziel „arch/x86/entry/syscalls/syscall_32.tbl“, 
  benötigt von „arch/x86/include/generated/uapi/asm/unistd_32.h“, zu erstellen.  Schluss.
make[1]: *** [arch/x86/Makefile:248: archheaders] Fehler 2
make[1]: Verzeichnis „/usr/src/linux-headers-6.2.0-32-generic“ wird verlassen
make: *** [Makefile:5: modules] Fehler 2

That is more or less saying:

*** No rule exists to create target 'arch/x86/entry/syscalls/syscall_32.tbl' required by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Ending.

Are there instructions on how to build the module?

build error on 6.2

[...]/vtty/vtty.c: In function ‘vtmx_read’:
[...]/vtty/vtty.c:454:54: error: implicit declaration of function ‘kernel_termios_to_user_termios’ [-Werror=implicit-function-declaration]
  454 |                   copystatus = kernel_termios_to_user_termios((struct termios2 __user*)ptr, &port->oob_data.termios);
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Compilation fails with kernel 6.4.4

First error is

vtty.c:283:24: error: initialization of ‘void (*)(struct tty_struct *, const struct ktermios *)’ from incompatible pointer type ‘void (*)(struct tty_struct *, struct ktermios *)’ [-Werror=incompatible-pointer-types]
  283 |         .set_termios = vtty_set_termios,

Signature of set_termios in struct tty_operations changed since 6.0.0. It can be easily fixed with this PR.

Second error is

vtty.c:449:54: error: implicit declaration of function ‘kernel_termios_to_user_termios’ [-Werror=implicit-function-declaration]
  449 |                                         copystatus = kernel_termios_to_user_termios((struct termios2 __user*)ptr, &port->oob_data.termios);

#include <linux/termios_internal.h> doesn't fix it because the symbol seems no longer exported. Trying to figure out how to solve it.

read from slave as regular serial device

I created two simple test programs in Python to send and receive data:

Write to master send.py:

#!/usr/bin/env python3
import serial
import time


if __name__ == '__main__':
    # causes: termios.error: (25, 'Inappropriate ioctl for device')
    # serial_port = serial.Serial(
    #    port='/dev/vtmx',
    #    baudrate=100000,
    #    parity=serial.PARITY_EVEN,
    #    stopbits=serial.STOPBITS_TWO,
    #    bytesize=serial.EIGHTBITS)

    serial_port = open('/dev/vtmx', 'w')

    while True:
        try:
            for i in range(10):
                msg = str(i)
                serial_port.write(msg)
                serial_port.flush()
                print(f"sent {msg}")
                time.sleep(0.5)
        except KeyboardInterrupt:
            break

    serial_port.close()

Read from slave recv.py:

#!/usr/bin/env python3
import serial

if __name__ == '__main__':
    serial_port = serial.Serial(
       port='/dev/ttyV0',
       baudrate=100000,
       parity=serial.PARITY_EVEN,
       stopbits=serial.STOPBITS_TWO,
       bytesize=serial.EIGHTBITS)

    print(f"serial port open: {serial_port.is_open}")

    while True:
        byte = serial_port.read()
        print(chr(byte))

    serial_port.close()

However, instantiating the serial port gets stuck somewhere at termios.tcsetattr.

How do I configure the master device such that I can read from the slave like a regular serial device?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.