console-server: Fix config of lpc_address and sirq sysfs attributes
This change fixes console-server to correctly configure lpc_address
and sirq for VUART devices. It modifies tty_find_device to store the
tty_sysfs_devnode path in the new console->tty.vuart.sysfs_devnode
as introduced by commit 30ea6385df2d7c6db6954d41555d667d509ba873.
Tested:
Manually modified the lpc_address and sirq sysfs attributes, then
restarted obmc-console-server. Checked that lpc_address and sirq
got configured to the values from the obmc-console confiugration
file.
Fixes: 30ea6385df2d ("console-server: Add PTY support for testing purposes")
Change-Id: I10b715690d428722f772245618d8aa6f928154f6
Signed-off-by: Oskar Senft <osk@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3edefa1..c05dd3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,10 @@
1. Deprecated D-Bus interface `xyz.openbmc_project.console` is no longer used.
2. config: Drop support for the `socket-id` configuration key
+### Fixed
+
+1. console-server: Fix configuration of lpc_address and sirq sysfs attributes
+
## [1.1.0] - 2023-06-07
### Added
diff --git a/console-server.c b/console-server.c
index 5715589..1337be0 100644
--- a/console-server.c
+++ b/console-server.c
@@ -150,14 +150,24 @@
goto out_free;
}
- /* Arbitrarily pick an attribute to differentiate UART vs VUART */
- rc = asprintf(&tty_vuart_lpc_addr, "%s/lpc_address", tty_sysfs_devnode);
- if (rc < 0) {
- goto out_free;
- }
+ // Default to non-VUART
+ console->tty.type = TTY_DEVICE_UART;
- rc = access(tty_vuart_lpc_addr, F_OK);
- console->tty.type = (!rc) ? TTY_DEVICE_VUART : TTY_DEVICE_UART;
+ /* Arbitrarily pick an attribute to differentiate UART vs VUART */
+ if (tty_sysfs_devnode) {
+ rc = asprintf(&tty_vuart_lpc_addr, "%s/lpc_address",
+ tty_sysfs_devnode);
+ if (rc < 0) {
+ goto out_free;
+ }
+
+ rc = access(tty_vuart_lpc_addr, F_OK);
+ if (!rc) {
+ console->tty.type = TTY_DEVICE_VUART;
+ console->tty.vuart.sysfs_devnode =
+ strdup(tty_sysfs_devnode);
+ }
+ }
rc = 0;