cups serial : no stop bits ?

Anonymous anonymous at
Sun Apr 24 03:50:13 PDT 2005


Owning an apple laserwriter with a serial port, I tried to install it with cups. I've been quite surprised to see that there is no "stop bits" settings in the serial port configuration : it seems that you have to set it up outside of cups, and there is no explanation here on the cups website (and I didnt't find anything on the web either).

Because my printer required this "2 stop bits" setting, I needed to add it to the cups serial backend. Here is a short explanation of what I did :

First get the source tree, then edit the serial.c in the "backend" subdirectory. Add the following lines after the "Set flow control" in the option processing part (line 413 in serial.c v1.56) :

      else if (strcasecmp(name, "stopbits") == 0)
        * Set stop bits... Added by sassa
        if (strcasecmp(value, "1") == 0)
          opts.c_cflag &= ~CSTOPB;
        else if (strcasecmp(value, "2") == 0)
          opts.c_cflag |= CSTOPB;

After you're done compiling, you can simply copy this new "serial" executable to /usr/lib/cups/backend/ (on my Mandrake) and add the stopbits=2 option in your /etc/cups/printers.conf. For example :
DeviceURI serial:/dev/ttyS0?baud=9600+bits=8+parity=none+flow=soft+stopbits=2

That's all. Beware that no configuration front-end will let you set it for now, you have to do it manually.

Fran├žois Lacombe

More information about the cups mailing list