src/mess/machine/apollo_kbd.c
| r14560 | r14561 | |
| 16 | 16 | #include "machine/apollo_kbd.h" |
| 17 | 17 | #include "sound/beep.h" |
| 18 | 18 | |
| 19 | #if defined(__linux__) |
| 19 | 20 | #include <unistd.h> |
| 20 | 21 | #include <fcntl.h> |
| 21 | 22 | #include <errno.h> |
| 22 | | |
| 23 | | #if defined(__linux__) |
| 24 | 23 | // on linux we may attach a real Apollo keyboard at /dev/ttyS0 |
| 25 | 24 | #include <termios.h> |
| 26 | 25 | #include <sys/ioctl.h> |
| r14560 | r14561 | |
| 494 | 493 | |
| 495 | 494 | int apollo_kbd_device::keyboard_tty::getchar() |
| 496 | 495 | { |
| 496 | #if defined(KBD_TTY_NAME) |
| 497 | 497 | UINT8 data; |
| 498 | 498 | if (m_tty_fd < 0 || read(m_tty_fd, &data, 1) != 1) { |
| 499 | 499 | return -1; |
| r14560 | r14561 | |
| 502 | 502 | m_connected = 1; |
| 503 | 503 | return data; |
| 504 | 504 | } |
| 505 | #else |
| 506 | return -1; |
| 507 | #endif |
| 505 | 508 | } |
| 506 | 509 | |
| 507 | 510 | void apollo_kbd_device::keyboard_tty::putchar(UINT8 data) |
| 508 | 511 | { |
| 512 | #if defined(KBD_TTY_NAME) |
| 509 | 513 | if (isConnected() && m_tty_fd >= 0 ) { |
| 510 | 514 | while (write(m_tty_fd, &data, 1) != 1) { |
| 511 | 515 | LOG(("keyboard_tty::putchar data=%02x errno=%d", data, errno )); |
| 512 | 516 | } |
| 513 | 517 | LOG2(("keyboard_tty::putchar -> %02x", data)); |
| 514 | 518 | } |
| 519 | #endif |
| 515 | 520 | } |
| 516 | 521 | |
| 517 | 522 | /*------------------------------------------------- |