From bf3543739db18c6cd52908f7c693cb64f43e3f23 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 1 Feb 2014 13:21:15 +0100 Subject: [PATCH] xf86OpenSerial: Add support server managed fds Try to get a server managed fd from the Options before trying to open the device node ourselves. Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer --- hw/xfree86/os-support/shared/posix_tty.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c index 4d08c1e85..6e2af001a 100644 --- a/hw/xfree86/os-support/shared/posix_tty.c +++ b/hw/xfree86/os-support/shared/posix_tty.c @@ -124,7 +124,11 @@ xf86OpenSerial(XF86OptionPtr options) return -1; } - SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK)); + fd = xf86CheckIntOption(options, "fd", -1); + + if (fd == -1) + SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK)); + if (fd == -1) { xf86Msg(X_ERROR, "xf86OpenSerial: Cannot open device %s\n\t%s.\n",