| 1 | /* |
| 2 | * Copyright 1997,1998 by UCHIYAMA Yasushi |
| 3 | * |
| 4 | * Permission to use, copy, modify, distribute, and sell this software and its |
| 5 | * documentation for any purpose is hereby granted without fee, provided that |
| 6 | * the above copyright notice appear in all copies and that both that |
| 7 | * copyright notice and this permission notice appear in supporting |
| 8 | * documentation, and that the name of UCHIYAMA Yasushi not be used in |
| 9 | * advertising or publicity pertaining to distribution of the software without |
| 10 | * specific, written prior permission. UCHIYAMA Yasushi makes no representations |
| 11 | * about the suitability of this software for any purpose. It is provided |
| 12 | * "as is" without express or implied warranty. |
| 13 | * |
| 14 | * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 16 | * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 20 | * PERFORMANCE OF THIS SOFTWARE. |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #ifdef HAVE_XORG_CONFIG_H |
| 25 | #include <xorg-config.h> |
| 26 | #endif |
| 27 | |
| 28 | #include <X11/X.h> |
| 29 | |
| 30 | #include "input.h" |
| 31 | #include "scrnintstr.h" |
| 32 | |
| 33 | #include "compiler.h" |
| 34 | |
| 35 | #include "xf86.h" |
| 36 | #include "xf86Priv.h" |
| 37 | #include "xf86_OSlib.h" |
| 38 | |
| 39 | #include <stdio.h> |
| 40 | #include <errno.h> |
| 41 | #include <sys/time.h> |
| 42 | #include <sys/file.h> |
| 43 | #include <assert.h> |
| 44 | #include <mach.h> |
| 45 | #include <hurd.h> |
| 46 | |
| 47 | int |
| 48 | xf86ProcessArgument(int argc, char **argv, int i) |
| 49 | { |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | void |
| 54 | xf86UseMsg() |
| 55 | { |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | void |
| 60 | xf86OpenConsole() |
| 61 | { |
| 62 | if (serverGeneration == 1) { |
| 63 | kern_return_t err; |
| 64 | mach_port_t device; |
| 65 | int fd; |
| 66 | |
| 67 | err = get_privileged_ports(NULL, &device); |
| 68 | if (err) { |
| 69 | errno = err; |
| 70 | FatalError("xf86KbdInit can't get_privileged_ports. (%s)\n", |
| 71 | strerror(errno)); |
| 72 | } |
| 73 | mach_port_deallocate(mach_task_self(), device); |
| 74 | |
| 75 | if ((fd = open("/dev/kbd", O_RDONLY | O_NONBLOCK)) < 0) { |
| 76 | fprintf(stderr, "Cannot open keyboard (%s)\n", strerror(errno)); |
| 77 | exit(1); |
| 78 | } |
| 79 | xf86Info.consoleFd = fd; |
| 80 | } |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | void |
| 85 | xf86CloseConsole() |
| 86 | { |
| 87 | close(xf86Info.consoleFd); |
| 88 | return; |
| 89 | } |