OpenPrinting / ipp-usb

ipp-usb -- HTTP reverse proxy, backed by IPP-over-USB connection to device
BSD 2-Clause "Simplified" License
129 stars 11 forks source link

Fail to add Canon Selphy CP1500 printer #73

Closed bwolleb closed 6 months ago

bwolleb commented 8 months ago

Hi,

I am trying to setup and use a Canon Selphy CP1500 on a Raspberry Pi 4B. Currently, it works well when it is added using network/dnssd but doesn't when connecting it in usb. Manually running the ipp-usb when connecting the printer indeed shows that something fails (log below).

I am using the latest Raspberry Pi OS / Debian 12 bookworm with cups 2.4.2 and ipp-usb 0.9.23 from the repository, and the printer firmware is up to date (version 1.0.2.0). I also tried compiling the current repo HEAD, and it gives the same result.

Do you have an idea of the problem?

+ HOTPLUG: added Bus 001 Device 026
+ PNP Bus 001 Device 026: added

  ===============================
+ Bus 001 Device 026: added SELPHY CP1500
  Device info:
    Ident:         04a9-3302-B122081513308562-Canon-SELPHY-CP1500
    Manufacturer:  Canon
    Product:       SELPHY CP1500
    SerialNumber:  B122081513308562
    MfgAndProduct: Canon SELPHY CP1500
    BasicCaps:     print,scan,fax,http

  Device quirks:
    from [*] (/usr/share/ipp-usb/quirks/default.conf:3)
      blacklist = false
      usb-max-interfaces = 0
      disable-fax = false
      init-delay = 0s
      request-delay = 0s
      http-connection = ""

  USB stack parameters
    authorized_default:          -1
    autosuspend:                 2
    blinkenlights:               N
    initial_descriptor_timeout:  5000
    nousb:                       N
    old_scheme_first:            N
    quirks:
    usbfs_memory_mb:             16
    usbfs_snoop:                 N
    usbfs_snoop_max:             65536
    use_both_schemes:            Y

  USB interfaces:
    Config Interface Alt Class SubClass Proto
       1       0      0   7      1       2
*      1       0      1   7      1       4
       1       1      0   255    0       0
*      1       1      1   7      1       4

  USB[0]: open: Bus 001 Device 026 Interface 0 Alt 1
  USB[1]: open: Bus 001 Device 026 Interface 1 Alt 1
> HTTP[091]: POST http://localhost:60000/ipp/print
> HTTP[091]: request body: got 462 bytes; closed
> HTTP[091]: body is small (462 bytes), prefetched before sending
  USB[0]: connection allocated, 1 in use: a-- ---
  HTTP[091]: connection 0 allocated
< HTTP[091]: POST http://localhost:60000/ipp/print - 200 OK
< HTTP[091]: response body: got 1129 bytes; EOF
  USB[0]: connection released, 0 in use: --- ---
! IPP: IPP: server-error-internal-error
> HTTP[092]: GET http://localhost:60000/eSCL/ScannerCapabilities
  USB[1]: connection allocated, 1 in use: --- a--
  HTTP[092]: connection 1 allocated
< HTTP[092]: GET http://localhost:60000/eSCL/ScannerCapabilities - 404 Not Found
< HTTP[092]: client has gone; draining response from USB
! ESCL: eSCL: HTTP status: 404 Not Found
- Bus 001 Device 026: resetting SELPHY CP1500
! USB[1]: recv: libusb_bulk_transfer: No such device (it may have been disconnected)
- Bus 001 Device 026: shutdown: 1 connections still in use
! USB[1]: recv: libusb_bulk_transfer: Input/Output Error
  USB[1]: connection released, 0 in use: --- ---
  USB[0]: closed
  USB[1]: closed
- Bus 001 Device 026: removed SELPHY CP1500
! PNP Bus 001 Device 026: Device doesn't implement print or scan service
alexpevzner commented 8 months ago

Hi @bwolleb,

can I see logs from /var/log/ipp-usb?

bwolleb commented 8 months ago

Of course, here is the full log, it seems there are all my unsuccessful attempts there. (This is from my laptop, not the raspberry pi, although I think it doesn't change anything since it is the same ipp-usb version).

04a9-3302-B122081513308562-Canon-SELPHY-CP1500.log

alexpevzner commented 8 months ago

Can I ask you to find the following lines in the ipp.go, line 178:

        // Check response status
        if msg.Code >= 100 {
                err = fmt.Errorf("IPP: %s", goipp.Status(msg.Code))
                return
        }

Comment it out, rebuild and retry?

bwolleb commented 8 months ago

I will, first thing I'll do tomorrow morning, thanks for your help!

alexpevzner commented 8 months ago

OK, no problem.

And even if we will get ipp-usb happy with your printer, it is not guaranteed that CUPS will be happy as well...

bwolleb commented 8 months ago

Ok nice, commenting those lines allowed ipp-usb to properly add the device, and CUPS was happy as well, I successfully printed two borderless photos. Here is the output of ipp-usb when the printer was detected:

  ===============================
  ipp-usb started in "debug" mode, pid=1592
  ctrlsock: listening at "/var/ipp-usb/ctrl"
+ HOTPLUG: added Bus 001 Device 008
+ PNP Bus 001 Device 008: added

  ===============================
+ Bus 001 Device 008: added SELPHY CP1500
  Device info:
    Ident:         04a9-3302-B122081513308562-Canon-SELPHY-CP1500
    Manufacturer:  Canon
    Product:       SELPHY CP1500
    SerialNumber:  B122081513308562
    MfgAndProduct: Canon SELPHY CP1500
    BasicCaps:     print,scan,fax,http

  Device quirks:
    from [*] (/usr/share/ipp-usb/quirks/default.conf:3)
      blacklist = false
      usb-max-interfaces = 0
      disable-fax = false
      init-delay = 0s
      request-delay = 0s
      http-connection = ""

  USB stack parameters
    authorized_default:          -1
    autosuspend:                 2
    blinkenlights:               N
    initial_descriptor_timeout:  5000
    nousb:                       N
    old_scheme_first:            N
    quirks:
    usbfs_memory_mb:             16
    usbfs_snoop:                 N
    usbfs_snoop_max:             65536
    use_both_schemes:            Y

  USB interfaces:
    Config Interface Alt Class SubClass Proto
       1       0      0   7      1       2
*      1       0      1   7      1       4
       1       1      0   255    0       0
*      1       1      1   7      1       4

  USB[0]: open: Bus 001 Device 008 Interface 0 Alt 1
  USB[1]: open: Bus 001 Device 008 Interface 1 Alt 1
> HTTP[000]: POST http://localhost:60000/ipp/print
> HTTP[000]: request body: got 462 bytes; closed
> HTTP[000]: body is small (462 bytes), prefetched before sending
  USB[0]: connection allocated, 1 in use: a-- ---
  HTTP[000]: connection 0 allocated
< HTTP[000]: POST http://localhost:60000/ipp/print - 200 OK
< HTTP[000]: response body: got 1129 bytes; EOF
  USB[0]: connection released, 0 in use: --- ---
> HTTP[001]: POST http://localhost:60000/ipp/faxout
> HTTP[001]: request body: got 463 bytes; closed
> HTTP[001]: body is small (463 bytes), prefetched before sending
  USB[1]: connection allocated, 1 in use: --- a--
  HTTP[001]: connection 1 allocated
< HTTP[001]: POST http://localhost:60000/ipp/faxout - 404 Not Found
< HTTP[001]: client has gone; draining response from USB
! IPP FaxOut probe failed: HTTP: 404 Not Found
> HTTP[002]: GET http://localhost:60000/eSCL/ScannerCapabilities
> HTTP[002]: body is chunked, sending as is
  USB[0]: connection allocated, 2 in use: a-- ar-
  HTTP[002]: connection 0 allocated
< HTTP[002]: GET http://localhost:60000/eSCL/ScannerCapabilities - 404 Not Found
< HTTP[002]: client has gone; draining response from USB
! ESCL: eSCL: HTTP status: 404 Not Found
> Canon SELPHY CP1500: _printer._tcp TXT record:
> Canon SELPHY CP1500: _ipp._tcp TXT record:
    air=none
    mopria-certified=2.1
    rp=ipp/print
    priority=50
    kind=photo
    PaperMax=<legal-A4
    URF=W8,SRGB24,V1.5,RS300,IS7,MT11,PQ4,OB9,IFU0,OFU0,CP99
    UUID=332f6000-1947-447e-b4d8-5c625af96216
    Color=T
    Duplex=F
    note=
    qtotal=1
    usb_MDL=SELPHY CP1500
    usb_MFG=Canon
    usb_CMD=URF
    ty=Canon SELPHY CP1500 HTTP
    product=(Canon SELPHY CP1500 HTTP)
    pdl=image/urf,application/octet-stream,image/jpeg,image/pwg-raster
    txtvers=1
    Fax=F
    Scan=F
> Canon SELPHY CP1500: _http._tcp TXT record:
> Canon SELPHY CP1500: _ipp-usb._tcp TXT record:
  DNS-SD: Canon SELPHY CP1500 (USB): trying
  USB[1]: connection released, 1 in use: ar- ---
  DNS-SD: FQDN: "msbproto.local"
  DNS-SD: FQDN: "msbproto.local"->"localhost"
  DNS-SD: +subtype: "_universal._sub._ipp._tcp"
+ DNS-SD: Canon SELPHY CP1500 (USB): publishing requested
  DNS-SD: Canon SELPHY CP1500 (USB): AVAHI_ENTRY_GROUP_REGISTERING
  USB[0]: connection released, 0 in use: --- ---
  DNS-SD: Canon SELPHY CP1500 (USB): AVAHI_ENTRY_GROUP_ESTABLISHED
  DNS-SD: Canon SELPHY CP1500 (USB): published
alexpevzner commented 7 months ago

Hi @bwolleb,

could you please retest with the latest github version. Please, run it direcly from the build directory (./ipp-usb), so it will use quirks files from the source directory, not from the system installation.

If you confirm that the problem is resolved, the fix will be included into the next release

bwolleb commented 7 months ago

Hi @alexpevzner, yes it still works using your latest commit on master. For the record, I still have to manually generate the ppd with the driverless command for borderless printing, but I guess it is another issue (maybe related to this one). Thanks for your work!

alexpevzner commented 6 months ago

Fixed in 0.9.24

switzel commented 4 months ago

I'm glad I found this issue because I'm having the same issue with a CP-1300. However my printer did work reliably in the past, so I located the commit that introduced the code: it is 7d21f23 from Februrary 2020, which is present already in release 0.9.0 and there are no earlier releases on GitHub. Does somebody have an explanation, how it would have worked before (it was certainly via ipp, not Gutenprint or something else)?

alexpevzner commented 4 months ago

Hi @switzel,

if problem in that commit, you can try disable-fax = true quirk (see man ipp-usb for description of quirk files).

If it help, let me know, I will add it to the known quirks, so with the next release it will be available for everybody