--- cups-1.2rc2/backend/serial.c 2006-03-07 23:07:44.000000000 +0100 +++ cups-1.2rc2.new/backend/serial.c 2006-04-13 15:44:03.000000000 +0200 @@ -87,6 +87,10 @@ # include #endif /* __APPLE__ */ +#if defined(__linux) || defined(linux) || defined(__linux__) +# include +# include +#endif /* * Local functions... @@ -670,13 +674,22 @@ int i, j; /* Looping vars */ int fd; /* File descriptor */ char device[255]; /* Device filename */ - + struct serial_struct serinfo; /* serial port info */ for (i = 0; i < 100; i ++) { sprintf(device, "/dev/ttyS%d", i); if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0) { + serinfo.reserved_char[0] = 0; /* setserial does this as well */ + if (ioctl(fd, TIOCGSERIAL, &serinfo)!=-1) /* unsupported ioctl? */ + { + if (serinfo.type==PORT_UNKNOWN) + { + close(fd); + continue; + } + } close(fd); # if defined(_ARCH_PPC) || defined(powerpc) || defined(__powerpc) printf("serial serial:%s?baud=230400 \"Unknown\" \"Serial Port #%d\"\n",