proposals for tty.c implementation
This commit is contained in:
parent
84879d0d36
commit
50df669b40
1 changed files with 10 additions and 0 deletions
10
tty.c
10
tty.c
|
@ -3,24 +3,34 @@
|
|||
|
||||
/* Opens the tty device and configures it. */
|
||||
int tty_open(struct tty_t *tty_dev) {
|
||||
// PROPOSAL:
|
||||
// open tty device to get file descriptor @tty_dev.fd
|
||||
// setup tty device parameters @tty_dev.ttyset
|
||||
// apply settings by calling tcsetattr(fd, ttyset)
|
||||
return 0;
|
||||
}
|
||||
/* Closes the tty device. */
|
||||
int tty_close(struct tty_t *tty_dev) {
|
||||
// close and set "tty_dev.fd = -1"
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reconfigures the tty device. */
|
||||
int tty_reconfigure(struct tty_t *tty_dev, struct termios newttyset) {
|
||||
// not sure how to organize this:
|
||||
// 1. parameters in external termios struct, copied @tty_dev.ttyset, applied with tcsetattr()
|
||||
// 2. parameters directly @tty_dev.ttyset, applied with tcsetattr()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reads incoming data from tty device to tty data buffer. */
|
||||
int tty_read(struct tty_t *tty_dev) {
|
||||
// read and save @tty_dev.data
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sends data from a buffer to tty device. */
|
||||
int tty_write(struct tty_t *tty_dev, char *databuf, int datalen) {
|
||||
// databuf should point to client data buffer
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue