OpenPrinting / system-config-printer

Graphical user interface for CUPS administration
GNU General Public License v2.0
156 stars 87 forks source link

Beeprt #261

Closed kuipou closed 2 years ago

kuipou commented 2 years ago

Hello I recently bought a BeePRT BY480BT two of them actually however upon checking the log they don't have any serial numbers so when they connect udev-create-printer assigns the same DeviceURI thinking its the same printer however I would like to append -1 or -2 to the DeviceURI but i would need to modify udev-create-printer

  1:00.0/usb1/1-1/1-1.3/1-1.3:1.0
Feb 11 10:04:36 solana kernel: [72856.525772] usb 1-1.3: new full-speed USB device number 9 using xhci_hcd
Feb 11 10:04:36 solana kernel: [72856.659783] usb 1-1.3: New USB device found, idVendor=09c6, idProduct=0426, bcdDevice= 2.00
Feb 11 10:04:36 solana kernel: [72856.659805] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Feb 11 10:04:36 solana kernel: [72856.670243] usblp 1-1.3:1.0: usblp1: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:04:36 solana systemd[1]: Started Configure Plugged-In Printer.
Feb 11 10:04:36 solana udev-configure-printer: add usb-001-009
Feb 11 10:04:37 solana udev-configure-printer: device devpath is /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
Feb 11 10:04:37 solana udev-configure-printer: MFG:Beeprt  MDL:BY-480BT SERN:- serial:-
Feb 11 10:04:42 solana kernel: [72861.982359] usblp1: removed
Feb 11 10:04:42 solana kernel: [72861.991416] usblp 1-1.3:1.0: usblp1: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:04:42 solana kernel: [72861.991947] usblp0: removed
Feb 11 10:04:42 solana kernel: [72862.000282] usblp 1-1.1:1.0: usblp0: USB Bidirectional printer dev 7 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:04:43 solana udev-configure-printer: URI matches without serial number: usb://Beeprt/BY-480BT
Feb 11 10:04:43 solana udev-configure-printer: No serial number URI matches so using those without
Feb 11 10:04:43 solana udev-configure-printer: URI of detected printer: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:04:43 solana udev-configure-printer: URI of print queue: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:04:43 solana udev-configure-printer: Queue ipp://localhost/printers/Beeprt-Label has matching device URI
Feb 11 10:04:43 solana udev-configure-printer: Re-enabled printer ipp://localhost/printers/Beeprt-Label
Feb 11 10:04:43 solana udev-configure-printer: URI of print queue: implicitclass://Canon_MG4200_series/, normalized: implicitclass canon mg4200 series
Feb 11 10:04:43 solana systemd[1]: configure-printer@usb-001-009.service: Succeeded.
Feb 11 10:05:04 solana kernel: [72883.883568] usb 1-1.1: USB disconnect, device number 7
Feb 11 10:05:04 solana kernel: [72883.884211] usblp0: removed
Feb 11 10:05:04 solana udev-configure-printer: remove /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0
Feb 11 10:05:04 solana udev-configure-printer: URI of detected printer: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:05:04 solana udev-configure-printer: URI of print queue: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:05:04 solana udev-configure-printer: Queue ipp://localhost/printers/Beeprt-Label has matching device URI
Feb 11 10:05:04 solana udev-configure-printer: Disabled printer ipp://localhost/printers/Beeprt-Label as the corresponding device was unplugged or turned off
Feb 11 10:05:04 solana udev-configure-printer: URI of print queue: implicitclass://Canon_MG4200_series/, normalized: implicitclass canon mg4200 series
Feb 11 10:05:04 solana udev-configure-printer: remove /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0
Feb 11 10:05:04 solana udev-configure-printer: remove /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0
Feb 11 10:05:07 solana kernel: [72887.506850] usb 1-1.1: new full-speed USB device number 10 using xhci_hcd
Feb 11 10:05:07 solana kernel: [72887.640918] usb 1-1.1: New USB device found, idVendor=09c6, idProduct=0426, bcdDevice= 2.00
Feb 11 10:05:07 solana kernel: [72887.640940] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Feb 11 10:05:07 solana kernel: [72887.646697] usblp 1-1.1:1.0: usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:05:07 solana systemd[1]: Started Configure Plugged-In Printer.
Feb 11 10:05:07 solana udev-configure-printer: add usb-001-010
Feb 11 10:05:08 solana udev-configure-printer: device devpath is /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1
Feb 11 10:05:08 solana udev-configure-printer: MFG:Beeprt  MDL:BY-480BT SERN:- serial:-
Feb 11 10:05:13 solana kernel: [72892.999054] usblp1: removed
Feb 11 10:05:13 solana kernel: [72893.008506] usblp 1-1.3:1.0: usblp1: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:05:13 solana kernel: [72893.009862] usblp0: removed
Feb 11 10:05:13 solana kernel: [72893.016067] usblp 1-1.1:1.0: usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x09C6 pid 0x0426
Feb 11 10:05:15 solana udev-configure-printer: URI matches without serial number: usb://Beeprt/BY-480BT
Feb 11 10:05:15 solana udev-configure-printer: No serial number URI matches so using those without
Feb 11 10:05:15 solana udev-configure-printer: URI of detected printer: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:05:15 solana udev-configure-printer: URI of print queue: usb://Beeprt/BY-480BT, normalized: beeprt by 480bt
Feb 11 10:05:15 solana udev-configure-printer: Queue ipp://localhost/printers/Beeprt-Label has matching device URI
Feb 11 10:05:15 solana udev-configure-printer: Re-enabled printer ipp://localhost/printers/Beeprt-Label
Feb 11 10:05:15 solana udev-configure-printer: URI of print queue: implicitclass://Canon_MG4200_series/, normalized: implicitclass canon mg4200 series
Feb 11 10:05:15 solana systemd[1]: configure-printer@usb-001-010.service: Succeeded.

I would like to know if someone could help me with this

zdohnal commented 2 years ago

Hi @kuipou ,

can CUPS recognize both printers if they are turned on and connected by usb?

You can check it by lpinfo -l -v. Because if CUPS cannot tell they are different devices, then neither udev-configure-printer, because it gets the list of connected devices from CUPS.

Changing device uri won't help you, because CUPS won't be able to find your printer - device uri for usb printers is created from USB data which CUPS gets from the printer - if you alter the device uri, then CUPS USB backend won't be able to match the uri with the printer you want to print to (because none of the printers has in its info -1 or -2).

kuipou commented 2 years ago

Cups only sees one DeviceURI the only difrentiator is the kernel bus this is the lpinfo -l -v

Device: uri = usb://Beeprt/BY-480BT
        class = direct
        info = Beeprt BY-480BT
        make-and-model = Beeprt BY-480BT
        device-id = MFG:Beeprt ;CMD:XPP,XL;MDL:BY-480BT;CLS:PRINTER;DES:BY-480BT;
        location =

both are connected this is the lsusb -v

Bus 001 Device 004: ID 09c6:0426
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x09c6
  idProduct          0x0426
  bcdDevice            2.00
  iManufacturer           0
  iProduct                0
  iSerial                 0
  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
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered
Bus 001 Device 005: ID 09c6:0426
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x09c6
  idProduct          0x0426
  bcdDevice            2.00
  iManufacturer           0
  iProduct                0
  iSerial                 0
  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
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered
zdohnal commented 2 years ago

@kuipou thank you for the info!

Since CUPS doesn't recognize the printers as two different device either, there's nothing to do on system-config-printer side. On the top of that, CUPS itself cannot do much about it - both printers use the same interface and have no serial number, so it is not doable for CUPS to tell a difference between them. In theory, you could use bus numbers to separate them, but this way you'll lock the device to a specific port - which IMHO is not desired.

kuipou commented 2 years ago

@zdohnal However if i actually want to lock it to a port how would it be possible?

zdohnal commented 2 years ago

You would need to update CUPS (usb backend). You would have to find out usb port where the printer is connected via libusb interface and put it into device uri. Additionally, you need to implement a way how to decompose the device uri when you are about to print to make sure you are sending the data onto correct USB port. And as I mentioned, the print queue would be bound to a specific port - if you change the USB port, CUPS will detect it as another printer and the previous print queue will not work...

kuipou commented 2 years ago

is there anyway you could help me out with this please?

zdohnal commented 2 years ago

I'm sorry IMO I cannot - from the point of view of system-config-printer, I only process data from CUPS - if CUPS doesn't report two devices, I cannot do much about it. From the point of view as a member of CUPS community, I don't plan to implement port dependent uri functionality in usb backend for two reasons:

You can try contacting your printer manufacturer for firmware update which will add serial numbers into device information presented via USB interface, or ask the manufacturer to provide a printer application - because although a printer application is connected to a specific TCP port, it is advertised by mDNS, so applications are able always find the correct device and don't depend on the uri.