Re: Raspberry Pi 3B USB Printing Issue

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Sat, 02 Apr 2022 00:30:25 UTC
On 4/2/22 00:56, Archimedes Gaviola wrote:
> On Fri, Apr 1, 2022 at 12:01 AM Hans Petter Selasky <hps@selasky.org> wrote:
> 
>> On 3/31/22 15:52, Archimedes Gaviola wrote:
>>> Are you pertaining to this code Hans, the one you've shared to me
>>> previously?
>>>
>>> +       /* Epson printer */
>>> +       {USB_VPI(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_TMU220B, 0)},
>>
>> Yes, but you can also add the IFACE_XXX ones with "," simply.
>>
> 
> Hi Hans,
> 
> Here's what I have come-up with based on my understanding from your
> suggestion. I took a look as well from other USB devices' sources. This
> compiles without any problems, still able to detect my printers and
> printing still works well. Let me know if this is correct or needs further
> changes.
> 
> freebsd@generic:~ % diff -Nur /usr/src/sys/dev/usb/serial/ulpt.c.orig
> /usr/src/sys/dev/usb/serial/ulpt.c
> --- /usr/src/sys/dev/usb/serial/ulpt.c.orig     2022-03-21
> 19:44:29.178010000 +0800
> +++ /usr/src/sys/dev/usb/serial/ulpt.c  2022-04-02 14:27:54.073592000 +0800
> @@ -499,6 +499,13 @@
>          {USB_IFACE_CLASS(UICLASS_PRINTER),
>           USB_IFACE_SUBCLASS(UISUBCLASS_PRINTER),
>           USB_IFACE_PROTOCOL(UIPROTO_PRINTER_1284)},
> +
> +       /* Epson printer */
> +       {USB_VENDOR(USB_VENDOR_EPSON),
> +        USB_PRODUCT(USB_PRODUCT_EPSON_TMU220B),
> +        USB_IFACE_CLASS(UICLASS_VENDOR),
> +        USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR),
> +        USB_IFACE_PROTOCOL(UIPROTO_PRINTER_BI)},
>   };
> 
>   static int
> @@ -555,9 +562,11 @@
>                                  break;
>                          } else {
>                                  alt_index++;
> -                               if ((id->bInterfaceClass ==
> UICLASS_PRINTER) &&
> -                                   (id->bInterfaceSubClass ==
> UISUBCLASS_PRINTER) &&
> -                                   (id->bInterfaceProtocol ==
> UIPROTO_PRINTER_BI)) {
> +                               if ((id->bInterfaceClass == UICLASS_PRINTER
> ||
> +                                   id->bInterfaceClass == UICLASS_VENDOR)
> &&
> +                                   (id->bInterfaceSubClass ==
> UISUBCLASS_PRINTER ||
> +                                   id->bInterfaceClass ==
> UISUBCLASS_VENDOR) &&
> +                                   (id->bInterfaceProtocol ==
> UIPROTO_PRINTER_BI)) {
>                                          goto found;
>                                  }
>                          }
> 
> freebsd@generic:~ % diff -Nur /usr/src/sys/dev/usb/usbdevs.orig
> /usr/src/sys/dev/usb/usbdevs
> --- /usr/src/sys/dev/usb/usbdevs.orig   2022-03-21 19:42:20.999397000 +0800
> +++ /usr/src/sys/dev/usb/usbdevs        2022-04-01 01:21:31.361567000 +0800
> @@ -1941,6 +1941,7 @@
>   product EPSON 2480             0x0121  Perfection 2480 scanner
>   product EPSON 3590             0x0122  Perfection 3590 scanner
>   product EPSON 4990             0x012a  Perfection 4990 Photo scanner
> +product EPSON TMU220B          0x0202  TM-U220B
>   product EPSON CRESSI_EDY       0x0521  Cressi Edy diving computer
>   product EPSON N2ITION3         0x0522  Zeagle N2iTion3 diving computer
>   product EPSON STYLUS_875DC     0x0601  Stylus Photo 875DC Card Reader
> 
> freebsd@generic:~ % dmesg
> ...
> ugen1.5: <EPSON EPSON UB-U03II> at usbus1
> ugen1.6: <Printer-58 USB Printing Support> at usbus1
> ulpt0 on uhub1
> ulpt0: <EPSON EPSON UB-U03II, class 0/0, rev 1.10/2.00, addr 5> on usbus1
> ulpt0: using bi-directional mode
> ulpt1 on uhub1
> ulpt1: <Printer-58 USB Printing Support, class 0/0, rev 2.00/2.54, addr 6>
> on usbus1
> ulpt1: using bi-directional mode
> ulpt1: offline
> 

Here you go:
https://cgit.freebsd.org/src/commit/?id=88162f7abd61206c98432f2c0de869a59be13854

Happy printing :-)

--HPS