'How to write to `/dev/ttyUSB?` in kernel space?

i want to send and receive data from/to an arduino connected to a /dev/ttyUSB port (serial) from a kernel module. i have seen enough ways how to do it in userspace, but that's not my question.

it would really help to be able to access a tty by major and minor numbers (188, 0 for /dev/ttyUSB0) as i dont want to use file io in a kernel module

related but didnt answer my question:

How to write to a tty from kernel space with only major and minor device numbers available? (1 answer but uses userspace)

Access /dev/ttyACM0 from kernel (no answers yet)

How can I write to TTY from a kernel module? (1 answer but how to get the struct tty_struct from a serial port?)

Read and write to Arduino serial using a kernel module (1 answer but uses file io and alternative is too vague)

https://unix.stackexchange.com/questions/585573/how-does-serial-driver-get-attached-to-a-tty-port (no answers yet)



Solution 1:[1]

SappyInsane on linuxquestions had the same problem and gave me his solution which worked https://www.linuxquestions.org/questions/linux-kernel-70/reading-from-arduino-serial-in-a-kernel-module-4175704822/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Antoni