summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_cpu_sparc64.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-03-12 17:06:03 +0000
committermarius <marius@FreeBSD.org>2005-03-12 17:06:03 +0000
commit24a06782ed706d41ac22a33c7bb277cc49931e12 (patch)
tree8c7a5637b1539d85536cf1fef4bf45c274ed80c0 /sys/dev/uart/uart_cpu_sparc64.c
parentcbc3f05d7ca6de6d96084d8a9c45f29394f71fcf (diff)
downloadFreeBSD-src-24a06782ed706d41ac22a33c7bb277cc49931e12.zip
FreeBSD-src-24a06782ed706d41ac22a33c7bb277cc49931e12.tar.gz
In uart_cpu_getdev_console() when determinig whether we should use
a serial console anyway because input-device is set to keyboard and output-device is set to screen but no keyboard is plugged in don't assume that a device node for the input-device alias exists. While this is true for RS232 keyboards (the node of the SCC and UART respectively which controls the keyboard doesn't disappear when no keyboard is plugged in) this assumption breaks for USB keyboards. It's most likely also not true for PS/2 keyboards but OFW doesn't reliably switch to a serial console when the potential keyboard is a PS/2 one which isn't plugged in so this couldn't be verified properly. Reported by: Will Andrews <will@csociety.org>, obrien MFC after: 1 week
Diffstat (limited to 'sys/dev/uart/uart_cpu_sparc64.c')
-rw-r--r--sys/dev/uart/uart_cpu_sparc64.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c
index 2b4abb7..6efc94a 100644
--- a/sys/dev/uart/uart_cpu_sparc64.c
+++ b/sys/dev/uart/uart_cpu_sparc64.c
@@ -97,8 +97,6 @@ uart_cpu_getdev_console(phandle_t options, char *dev, size_t devsz)
if (OF_getprop(options, "input-device", dev, devsz) == -1)
return (-1);
- if ((input = OF_finddevice(dev)) == -1)
- return (-1);
if (OF_getprop(options, "output-device", buf, sizeof(buf)) == -1)
return (-1);
if (!strcmp(dev, "keyboard") && !strcmp(buf, "screen")) {
@@ -113,8 +111,12 @@ uart_cpu_getdev_console(phandle_t options, char *dev, size_t devsz)
if (OF_instance_to_package(stdout) != input)
return (-1);
snprintf(dev, devsz, "ttya");
- } else if (OF_finddevice(buf) != input)
- return (-1);
+ } else {
+ if ((input = OF_finddevice(dev)) == -1)
+ return (-1);
+ if (OF_finddevice(buf) != input)
+ return (-1);
+ }
if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
return (-1);
if (strcmp(buf, "serial") != 0)
OpenPOWER on IntegriCloud