Lines Matching full:tty
136 /* populates server->tty.dev and server->tty.sysfs_devnode, using the tty kernel name */
149 server->tty.type = TTY_DEVICE_UNDEFINED; in tty_find_device()
151 assert(server->tty.kname); in tty_find_device()
152 if (!strlen(server->tty.kname)) { in tty_find_device()
153 warnx("TTY kname must not be empty"); in tty_find_device()
158 if (server->tty.kname[0] == '/') { in tty_find_device()
159 tty_path_input = strdup(server->tty.kname); in tty_find_device()
165 rc = asprintf(&tty_path_input, "/dev/%s", server->tty.kname); in tty_find_device()
171 /* udev may rename the tty name with a symbol link, try to resolve */ in tty_find_device()
185 server->tty.type = TTY_DEVICE_PTY; in tty_find_device()
186 server->tty.dev = strdup(server->tty.kname); in tty_find_device()
187 rc = server->tty.dev ? 0 : -1; in tty_find_device()
193 warn("Can't find real name for %s", server->tty.kname); in tty_find_device()
198 rc = asprintf(&tty_class_device_link, "/sys/class/tty/%s", in tty_find_device()
211 rc = asprintf(&server->tty.dev, "/dev/%s", tty_kname_real); in tty_find_device()
217 server->tty.type = TTY_DEVICE_UART; in tty_find_device()
219 /* Prior to 6.8, we have the tty device directly under the platform in tty_find_device()
223 * 1e787000.serial/tty/ttySx/ in tty_find_device()
229 * 1e787000.serial/1e787000.serial:0/1e787000.serial:0.0/tty/ttySx/ in tty_find_device()
270 server->tty.type = TTY_DEVICE_VUART; in tty_find_device()
271 server->tty.vuart.sysfs_devnode = in tty_find_device()
297 assert(server->tty.type == TTY_DEVICE_VUART); in tty_set_sysfs_attr()
299 if (!server->tty.vuart.sysfs_devnode) { in tty_set_sysfs_attr()
303 rc = asprintf(&path, "%s/%s", server->tty.vuart.sysfs_devnode, name); in tty_set_sysfs_attr()
311 server->tty.kname); in tty_set_sysfs_attr()
320 server->tty.kname); in tty_set_sysfs_attr()
330 * Set termios attributes on the console tty.
337 rc = tcgetattr(server->tty.fd, &termios); in tty_init_termios()
339 warn("Can't read tty termios"); in tty_init_termios()
343 if (server->tty.type == TTY_DEVICE_UART && server->tty.uart.baud) { in tty_init_termios()
344 if (cfsetspeed(&termios, server->tty.uart.baud) < 0) { in tty_init_termios()
345 warn("Couldn't set speeds for %s", server->tty.kname); in tty_init_termios()
354 rc = tcsetattr(server->tty.fd, TCSANOW, &termios); in tty_init_termios()
356 warn("Can't set terminal options for %s", server->tty.kname); in tty_init_termios()
365 assert(server->tty.type == TTY_DEVICE_VUART); in tty_init_vuart_io()
367 if (server->tty.vuart.sirq) { in tty_init_vuart_io()
368 tty_set_sysfs_attr(server, "sirq", server->tty.vuart.sirq); in tty_init_vuart_io()
371 if (server->tty.vuart.lpc_addr) { in tty_init_vuart_io()
373 server->tty.vuart.lpc_addr); in tty_init_vuart_io()
379 server->tty.fd = open(server->tty.dev, O_RDWR); in tty_init_io()
380 if (server->tty.fd <= 0) { in tty_init_io()
381 warn("Can't open tty %s", server->tty.dev); in tty_init_io()
388 fcntl(server->tty.fd, F_SETFL, FNDELAY); in tty_init_io()
393 console_server_request_pollfd(server, server->tty.fd, POLLIN); in tty_init_io()
410 assert(server->tty.type == TTY_DEVICE_VUART); in tty_init_vuart()
427 server->tty.vuart.lpc_addr = (uint16_t)parsed; in tty_init_vuart()
447 server->tty.vuart.sirq = (int)parsed; in tty_init_vuart()
463 server->tty.kname = tty_arg; in tty_init()
464 } else if ((val = config_get_value(config, "upstream-tty"))) { in tty_init()
465 server->tty.kname = val; in tty_init()
467 warnx("Error: No TTY device specified"); in tty_init()
476 switch (server->tty.type) { in tty_init()
488 if (config_parse_baud(&server->tty.uart.baud, val)) { in tty_init()
497 warnx("Cannot configure unrecognised TTY device"); in tty_init()
511 if (server->tty.type == TTY_DEVICE_VUART) { in tty_fini()
512 free(server->tty.vuart.sysfs_devnode); in tty_fini()
515 free(server->tty.dev); in tty_fini()
626 return write_buf_to_fd(console->server->tty.fd, data, len); in console_data_out()
1017 rc = read(server->tty.fd, buf, sizeof(buf)); in run_console_iteration()
1019 warn("Error reading from tty device"); in run_console_iteration()
1334 errx(EXIT_FAILURE, "no tty device path has been provided\n"); in main()