Ubuntu – Send raw data to USB parallel port after upgrading to 11.10

11.10devicesprintingusb

I have a laser cutter connected via a generic USB to parallel adapter. The laser cutter speaks HPGL, as it happens, but since this is a laser cutter and not a plotter, I usually want to generate the HPGL myself, since I care about the ordering, speed, and direction of cuts and so on.

In previous versions of Ubuntu, I was able to print to the cutter by copying an HPGL file directly to the corresponding USB "lp" device. For example:

cp foo.plt /dev/usblp1

Well, I just upgraded to Ubuntu 11.10 oneiric, and I can't find any "lp" devices in /dev anymore. D'oh!

What's the preferred way to send raw data to a parallel port in Ubuntu? I've tried System Settings > Printing > + Add, hoping that I might be able to associate my device with some kind of "raw printer" driver and print to it with a command like

lp -d LaserCutter foo.plt

But my USB to parallel adapter doesn't seem to show up in the list. What I do see are my HP Color LaserJet, two USB-to-serial adapters, "Enter URI", and "Network Printer".

Meanwhile, over in /dev, I do see /dev/ttyUSB0 and /dev/ttyUSB1 devices for the 2 USB-to-serial adapters. I don't see anything obvious corresponding to the HP printer (which was /dev/usblp0 prior to the upgrade), except for generic USB stuff. For example, sudo find /dev | grep lp produces no output. I do seem to be able to print to the HP printer just fine, though. The printer setup GUI gives it a device URI starting with "hp:" which isn't much help for the parallel adapter.

The CUPS administrator's guide makes it sound like I might need to feed it a device URI of the form parallel:/dev/SOMETHING, but of course if I had a /dev/SOMETHING I'd probably just go on writing to it directly.

Here's what dmesg says after I disconnect and reconnect the device from the USB port:

[  924.722906] usb 1-1.1.4: USB disconnect, device number 7
[  959.993002] usb 1-1.1.4: new full speed USB device number 8 using ehci_hcd

And here's how it shows up in lsusb -v:

Bus 001 Device 008: ID 1a86:7584 QinHeng Electronics CH340S
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1a86 QinHeng Electronics
  idProduct          0x7584 CH340S
  bcdDevice            2.52
  iManufacturer           0 
  iProduct                2 USB2.0-Print 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               96mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

Best Answer

The /dev/usb/lpX device files you are looking for are provided by the usblp driver. It seems in Ubuntu 11.10 though, that this driver has been blacklisted. See the /etc/modprobe.d/blacklist-cups-usblp.conf file:

# cups talks to the raw USB devices, so we need to blacklist usblp to avoid
# grabbing them
blacklist usblp

If you want to send data directly to the device still, you can temporarily load the driver with modprobe usblp (the blacklist only prevents the driver from being automatically loaded). Once you are done, you can unload it with modprobe -r usblp.

Related Question