/* *noneedtochecktheindexhere:iftheindexiswrong,console *codewon'tcallus
*/
port = usb_serial_port_get_by_minor(co->index); if (port == NULL) { /* no device is connected yet, sorry :( */
pr_err("No USB device connected to ttyUSB%i\n", co->index); return -ENODEV;
}
serial = port->serial;
retval = usb_autopm_get_interface(serial->interface); if (retval) goto error_get_interface;
/* only call the device specific open if this
* is the first time the port is opened */
retval = serial->type->open(NULL, port); if (retval) {
dev_err(&port->dev, "could not open USB console port\n"); goto fail;
}
tty_port_tty_set(&port->port, NULL);
tty_save_termios(tty);
tty_kref_put(tty);
}
tty_port_set_initialized(&port->port, true);
} /* Now that any required fake tty operations are completed restore
* the tty port count */
--port->port.count; /* The console is special in terms of closing the device so
* indicate this port is now acting as a system console. */
port->port.console = 1;
if (!port->port.console) {
dev_dbg(&port->dev, "%s - port not opened\n", __func__); return;
}
while (count) { unsignedint i; unsignedint lf; /* search for LF so we can insert CR if necessary */ for (i = 0, lf = 0 ; i < count ; i++) { if (*(buf + i) == 10) {
lf = 1;
i++; break;
}
} /* pass on to the driver specific version of this function if
it is available */
retval = serial->type->write(NULL, port, buf, i);
dev_dbg(&port->dev, "%s - write: %d\n", __func__, retval); if (lf) { /* append CR after LF */ unsignedchar cr = 13;
retval = serial->type->write(NULL, port, &cr, 1);
dev_dbg(&port->dev, "%s - write cr: %d\n",
__func__, retval);
}
buf += i;
count -= i;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.