michaelrsweet / lprint

A Label Printer Application
https://www.msweet.org/lprint
Apache License 2.0
219 stars 29 forks source link

Munbyn ITPP941 not detected #115

Closed proski closed 5 months ago

proski commented 5 months ago

I'm using the current master branch of lprint on up-to-date Fedora 39 x86_64 with pappl 1.4.4 and CUPS 2.4.7.

lprint fails to see the Munbyn ITPP941 label printer. It sees other printers.

$ ~/opt/lprint/bin/lprint devices
dnssd://HP%5C032LaserJet%5C032Pro%5C0324001%5C032%5C0915EF1A4%5C093._pdl-datastream._tcp.local/
dnssd://HP%5C032Smart%5C032Tank%5C032Plus%5C032550%5C032series%5C032%5C091F65D89%5C093._pdl-datastream._tcp.local/
dnssd://SAWGRASS%5C032SG500%5C032%5C091430366%5C093._pdl-datastream._tcp.local/
snmp://SG500

lpinfo sees the label printer.

$ lpinfo -v
network socket
network ipp
file cups-brf:/
network beh
network https
network http
network lpd
network ipps
direct hp
direct usb://Munbyn/ITPP941?serial=9412033000184
network smb
direct hpfax
network socket://192.168.2.201
network dnssd://HP%20LaserJet%20Pro%204001%20%5B5EF1A4%5D._ipp._tcp.local/?uuid=feeb6818-60b4-4748-8ac1-2d5981b7de62
network dnssd://HP%20Smart%20Tank%20Plus%20550%20series%20%5BF65D89%5D._ipp._tcp.local/?uuid=c6e45425-6d18-5faa-aa97-5fe4d59b2b98
network dnssd://SAWGRASS%20SG500%20%5B430366%5D._pdl-datastream._tcp.local/
network ipp://SAWGRASS%20SG500%20%5B430366%5D._ipp._tcp.local/
network ipps://HP%20LaserJet%20Pro%204001%20%5B5EF1A4%5D._ipps._tcp.local/
network ipps://HP%20Smart%20Tank%20Plus%20550%20series%20%5BF65D89%5D._ipps._tcp.local/
network ipps://Munbyn._ipps._tcp.local/

Adding the printer appears to work (lprint server is running in another terminal):

$ ~/opt/lprint/bin/lprint add -d Munbyn -m tspl_203dpi -v usb://Munbyn/ITPP941?serial=9412033000184
$ ~/opt/lprint/bin/lprint default -d Munbyn
$ ~/opt/lprint/bin/lprint submit ~/Downloads/Labels-Sample.pdf
Munbyn-1

However, the server cannot see the printer:

$ ~/opt/lprint/bin/lprint server
E [2024-01-20T20:50:50.728Z] Unable to register 'LPrint._ipps-system._tcp': Local name collision
E [2024-01-20T20:51:18.813Z] Unable to register 'LPrint._ipps-system._tcp': Local name collision
E [2024-01-20T20:51:18.821Z] [Printer Munbyn] Unable to register 'Munbyn._ipp._tcp': Local name collision
E [2024-01-20T20:51:18.823Z] [Printer Munbyn] Unable to register 'Munbyn._ipps._tcp': Local name collision
E [2024-01-20T20:51:52.044Z] [Printer Munbyn] Unable to open device 'usb://Munbyn/ITPP941?serial=9412033000184', pausing queue until printer becomes available.

Nothing gets printed.

lsusb output for the printer:

$ sudo lsusb -v -d 09c6:0248

Bus 001 Device 007: ID 09c6:0248 [unknown] [unknown]
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x09c6 [unknown]
  idProduct          0x0248 [unknown]
  bcdDevice            2.00
  iManufacturer           1 Printer
  iProduct                2 Printer
  iSerial                 3 9412033000184
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    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     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 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     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0001
  Self Powered

I'm surprised that "Munbyn" and "ITPP941" don't even appear in lsusb output, yet lpinfo uses them in the URI.

michaelrsweet commented 5 months ago

On Linux you need to run lprint as root or be a member of the group that owns the USB device files.

proski commented 5 months ago

Thank you! Indeed, running lprint as root gave me the correct URI. It has an extra space encoded as %20 after Munbyn.

usb://Munbyn%20/ITPP941?serial=9412033000184

The new URL is working (with a lot of struggle, not directly related to this issue). I was able to print a PDF document from an Android phone. I still cannot print anything locally, but that would be better discussed in another issue.

Maybe lprint should print a warning that it cannot access USB devices?

Also, it's not good that lpinfo -v and lprint devices produce different URIs. Maybe one of them should be modified to match the other? Then the USB device matching code should accept differences in spacing in URIs vs devices.

michaelrsweet commented 5 months ago

First, that's a highly system-specific thing. I can't even make it a Linux conditional because every distro supports USB slightly differently... :/

Second, the legacy USB URIs that CUPS 2.x puts out are specific to CUPS 2.x and are NOT a standardized thing. PAPPL (which LPrint uses) generates similar URIs but the values are what PAPPL and libusb require.