+ /* The serial8250 driver has a hardcoded number of ports.
+ * The only way to tell which actually exist on a given system
+ * is to try to open them and make an ioctl call. */
+ driver = udev_device_get_driver(ud_parent);
+ if (driver && !strcmp(driver, "serial8250"))
+ {
+ if ((fd = open(name, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0)
+ goto skip;
+ ioctl_result = ioctl(fd, TIOCGSERIAL, &serial_info);
+ close(fd);
+ if (ioctl_result != 0)
+ goto skip;
+ if (serial_info.type == PORT_UNKNOWN)
+ goto skip;
+ }