* Getting help in writing tty driver
@ 2023-07-07 11:07 Ayush Singh
2023-07-07 12:04 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Ayush Singh @ 2023-07-07 11:07 UTC (permalink / raw)
To: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]
Hello everyone, I am working on a Google Summer of Code 2023 project [1]
under BeagleBoard.or. In this project, I have to write a Linux driver that
exposes `dev/ttyMCU0` (or something else) which can be accessed as a Serial
tty by MCUmgr [2]. This then sends the data and gets the response from the
CC1352 processor in BeagelPlay [3], which runs Zephyr over HDLC UART (the
data for this tty port has a particular HDLC address).
However, all the resources I could find seem to use deprecated or old APIs
(like `alloc_tty_driver` instead of `tty_alloc_driver`). After some trial
and error, I was able to transfer the data written to `ttyMCU0` to CC1352
using `write` in `tty_operations`. However, I am stumped on how to send
data to tty from the driver so that the userspace application can read it
(like using `cat`). Supposedly it should be done using
`tty_insert_flip_char` but the signature for this function in the tutorials
and the one present at `tty_flip.h` is quite different and does not seem to
work for me. Also, there seems to be something about the Echo flag but not
sure what all that is.
Finally, I am not sure I understand the relationship between tty port, tty
device, and tty driver either so it would be great if someone can guide me
to resources related to tty. I think a simple tty echo driver should allow
me to get the hang of what I am supposed to do.
Ayush
[1]: https://elinux.org/BeagleBoard/GSoC/2023_Proposal/AyushSingh
[2]: https://github.com/apache/mynewt-mcumgr
[3]: https://beagleboard.org/play
[4]:
https://git.beagleboard.org/gsoc/greybus/beagleplay-greybus-driver/-/tree/develop
[-- Attachment #1.2: Type: text/html, Size: 2056 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Getting help in writing tty driver
2023-07-07 11:07 Getting help in writing tty driver Ayush Singh
@ 2023-07-07 12:04 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-07-07 12:04 UTC (permalink / raw)
To: Ayush Singh; +Cc: kernelnewbies
On Fri, Jul 07, 2023 at 04:37:53PM +0530, Ayush Singh wrote:
> Hello everyone, I am working on a Google Summer of Code 2023 project [1]
> under BeagleBoard.or. In this project, I have to write a Linux driver that
> exposes `dev/ttyMCU0` (or something else) which can be accessed as a Serial
> tty by MCUmgr [2]. This then sends the data and gets the response from the
> CC1352 processor in BeagelPlay [3], which runs Zephyr over HDLC UART (the
> data for this tty port has a particular HDLC address).
>
> However, all the resources I could find seem to use deprecated or old APIs
> (like `alloc_tty_driver` instead of `tty_alloc_driver`). After some trial
> and error, I was able to transfer the data written to `ttyMCU0` to CC1352
> using `write` in `tty_operations`. However, I am stumped on how to send
> data to tty from the driver so that the userspace application can read it
> (like using `cat`). Supposedly it should be done using
> `tty_insert_flip_char` but the signature for this function in the tutorials
> and the one present at `tty_flip.h` is quite different and does not seem to
> work for me. Also, there seems to be something about the Echo flag but not
> sure what all that is.
>
> Finally, I am not sure I understand the relationship between tty port, tty
> device, and tty driver either so it would be great if someone can guide me
> to resources related to tty. I think a simple tty echo driver should allow
> me to get the hang of what I am supposed to do.
Try looking at the tty driver example in the book, "Linux Device
Drivers, third edition". It's out of date, but the ideas a much the
same in places for tty drivers. And then look at any of the hundreds of
in-kernel tty drivers for examples of what to do. You might want to
look at the "smaller" ones as you don't want to get bogged down with the
uart-specific stuff.
good luck!
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-07 12:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 11:07 Getting help in writing tty driver Ayush Singh
2023-07-07 12:04 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox