int bsd_check_tty(const char *devname) { int fd; ticables_info(_("Check for tty support:")); ticables_info(_(" tty support: available.")); // check for node usability ticables_info(_("Check for tty usability:")); if(check_for_node_usability(devname) == -1) return ERR_TTDEV; // check for device availability fd = open(devname, 0); if (fd == -1) { ticables_warning("unable to open serial device '%s'", devname); return ERR_TTDEV; } ticables_info(_(" is useable: yes")); close(fd); return 0; }
int linux_check_tiusb(const char *devname) { int fd; int arg; // check for node usability ticables_info(_("Check for tiusb usability:")); if(check_for_node_usability(devname) == -1) return ERR_TTDEV; #ifdef HAVE_LINUX_TICABLE_H // check for device availability fd = open(devname, 0); if (fd == -1) { ticables_warning("unable to open USB device '%s'", devname); return ERR_TTDEV; } if (ioctl(fd, IOCTL_TIUSB_GET_MAXPS, &arg) == -1) return ERR_TTDEV; ticables_info(_(" is useable: yes")); close(fd); return 0; #else fd = arg = -1; ticables_info(_(" tiusb support: not compiled.")); return ERR_TTDEV; #endif }
int linux_check_tty(const char *devname) { ticables_info(_("Check for tty usability:")); if(check_for_node_usability(devname) == -1) return ERR_TTDEV; return 0; }
int linux_check_tty(const char *devname) { int fd; #ifdef HAVE_LINUX_SERIAL_H struct serial_struct serinfo; memset(&serinfo, 0, sizeof(serinfo)); #endif ticables_info(_("Check for tty support:")); #ifdef HAVE_LINUX_SERIAL_H ticables_info(_(" tty support: available.")); #else ticables_info(_(" tty support: not compiled.")); return ERR_TTDEV; #endif // check for node usability ticables_info(_("Check for tty usability:")); if(check_for_node_usability(devname) == -1) { ticables_warning(_("not usable")); return ERR_TTDEV; } #ifdef HAVE_LINUX_SERIAL_H // check for device availability fd = open(devname, 0); if (fd == -1) { ticables_warning(_("unable to open serial device '%s'"), devname); return ERR_TTDEV; } serinfo.reserved_char[0] = 0; if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0) { ticables_warning(_("Error running TIOCGSERIAL ioctl on device %s - %s"), devname, strerror(errno)); close(fd); return ERR_TTDEV; } if(serinfo.type == PORT_UNKNOWN || serinfo.type == PORT_MAX) { ticables_info(_(" is useable: no")); close(fd); return ERR_TTDEV; } ticables_info(_(" is useable: yes")); close(fd); #endif return 0; }
int linux_check_parport(const char *devname) { int fd; ticables_info(_("Check for parport support:")); #ifdef HAVE_LINUX_PARPORT_H ticables_info(_(" parport support: available.")); #else ticables_info(_(" parport support: not compiled.")); return ERR_PPDEV; #endif // check for node usability ticables_info(_("Check for parport usability:")); if(check_for_node_usability(devname) == -1) return ERR_PPDEV; #ifdef HAVE_LINUX_PARPORT_H // check for device availability fd = open(devname, 0); if (fd == -1) { ticables_warning("unable to open parallel device '%s'.", devname); return ERR_PPDEV; } if (ioctl(fd, PPCLAIM) == -1) { ticables_info(_(" is useable: no")); close(fd); return ERR_PPDEV; } ticables_info(_(" is useable: yes")); if (ioctl(fd, PPRELEASE) == -1) { ticables_info("unable to release parallel device '%s'", devname); } close(fd); #endif return 0; }