Date: Sun, 27 Mar 2022 13:55:18 +0800 From: Archimedes Gaviola <archimedes.gaviola@gmail.com> To: Hans Petter Selasky <hps@selasky.org> Cc: freebsd-arm@freebsd.org Subject: Re: Raspberry Pi 3B USB Printing Issue Message-ID: <CAJFbk7GAz44pwFUdYQJKMfDA1EXZ%2BJSqYCxeRyuCaYk-u%2BiPNw@mail.gmail.com> In-Reply-To: <a5d5f948-fdc8-037c-dda6-5291e7440e28@selasky.org> References: <CAJFbk7EzSfPNbaGxiweKrivwNrKXCPVzA1b7_=0_bTvbs8oBow@mail.gmail.com> <7c67118e-f6ec-c87d-9a81-3ee6a5952f49@selasky.org> <CAJFbk7GYbLAFTJY077Nzh3CTBJM6bk8swr4AkgGMaukCxrfcHQ@mail.gmail.com> <60f98b10-dcdc-cdf4-3d7a-fe9fd4dff223@selasky.org> <CAJFbk7EAjrQG5Kj_upVKW72opOS%2B8d63VrMnQdLxcJjUcfsd=g@mail.gmail.com> <8226461b-5740-9c19-0575-2740bd952e16@selasky.org> <CAJFbk7FMa_8EXM70HdhgdLmkpjpRD54fRrO=uctHV4uQ2_nNhA@mail.gmail.com> <5fcece51-b014-330e-b701-fd75fa1ac204@selasky.org> <CAJFbk7Gx1i5r-KunNP41re7A_6m%2BYPO6K3Ru-J=0xqidNQsj7A@mail.gmail.com> <a5d5f948-fdc8-037c-dda6-5291e7440e28@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000007d718f05db2cd7d3 Content-Type: text/plain; charset="UTF-8" On Sat, Mar 12, 2022 at 4:41 PM Hans Petter Selasky <hps@selasky.org> wrote: > On 3/12/22 08:07, Archimedes Gaviola wrote: > > ugen1.5: <EPSON EPSON UB-U03II> at usbus1 > > ulpt1 on uhub1 > > ulpt1: <EPSON EPSON UB-U03II, class 0/0, rev 1.10/2.00, addr 5> on usbus1 > > device_attach: ulpt1 attach returned 12 > > 12 : man errno : > 12 ENOMEM Cannot allocate memory. > > I guess the EPSON printer you've got is not compatible with ulpt<n> > > When printing, can you make sure that the length transferred is never a > multiple of 64 bytes? > > Also, there might be a bug lurking in the USB host controller driver, > like already mentioned. > Hi Hans, I just figured-out the ulpt(4) driver in my Epson printer while comparing with my Xprinter printer's USB device info. My Epson printer is providing vendor specific values of 255 in the bInterfaceClass and bInterfaceSubClass respectively. bInterfaceClass = 0x00ff <Vendor specific> bInterfaceSubClass = 0x00ff It should be a value of 7 for bInterfaceClass and a value of 1 in bInterfaceSubClass. bInterfaceClass = 0x0007 <Printer device> bInterfaceSubClass = 0x0001 So, the ulpt_attach() routine below will break upon validation for mismatched values in UICLASS_PRINTER and UISUBCLASS_PRINTER. } else { alt_index++; if ((id->bInterfaceClass == UICLASS_PRINTER) && (id->bInterfaceSubClass == UISUBCLASS_PRINTER) && (id->bInterfaceProtocol == UIPROTO_PRINTER_BI)) { goto found; } } What I did is temporarily replace these values in the USB definition. In this case, how should the project handle this non-compliance USB devices? Though I will raise this to Epson if they could provide an updated firmware. freebsd@generic:~ % diff -Nur /usr/src/sys/dev/usb/usb.h.orig /usr/src/sys/dev/usb/usb.h --- /usr/src/sys/dev/usb/usb.h.orig 2022-03-27 02:55:01.319235000 +0800 +++ /usr/src/sys/dev/usb/usb.h 2022-03-27 02:57:10.608518000 +0800 @@ -459,8 +459,10 @@ #define UICLASS_PHYSICAL 0x05 #define UICLASS_IMAGE 0x06 #define UISUBCLASS_SIC 1 /* still image class */ -#define UICLASS_PRINTER 0x07 -#define UISUBCLASS_PRINTER 1 +/* #define UICLASS_PRINTER 0x07 */ +/* #define UISUBCLASS_PRINTER 1 */ +#define UICLASS_PRINTER 0xff +#define UISUBCLASS_PRINTER 0xff I can print now with ulpt(4) driver but need further testing for any issues. ugen1.5: <EPSON EPSON UB-U03II> at usbus1 ulpt0 on uhub1 ulpt0: <EPSON EPSON UB-U03II, class 0/0, rev 1.10/2.00, addr 5> on usbus1 ulpt_attach: setting alternate config number: 0 ulpt0: using bi-directional mode Thanks, Archimedes --0000000000007d718f05db2cd7d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Sat, Mar 12, 2022 at 4:41 PM Hans = Petter Selasky <<a href=3D"mailto:hps@selasky.org">hps@selasky.org</a>&g= t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p= x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 3/1= 2/22 08:07, Archimedes Gaviola wrote:<br> > ugen1.5: <EPSON EPSON UB-U03II> at usbus1<br> > ulpt1 on uhub1<br> > ulpt1: <EPSON EPSON UB-U03II, class 0/0, rev 1.10/2.00, addr 5> = on usbus1<br> > device_attach: ulpt1 attach returned 12<br> <br> 12 : man errno :<br> =C2=A0 =C2=A0 =C2=A0 12 ENOMEM Cannot allocate memory.<br> <br> I guess the EPSON printer you've got is not compatible with ulpt<n&g= t;<br> <br> When printing, can you make sure that the length transferred is never a <br= > multiple of 64 bytes?<br> <br> Also, there might be a bug lurking in the USB host controller driver, <br> like already mentioned.<br></blockquote><div><br></div></div><div class=3D"= gmail_quote"><br></div><div class=3D"gmail_quote">Hi Hans,</div><div class= =3D"gmail_quote"><br></div><div class=3D"gmail_quote">I just figured-out th= e ulpt(4) driver in my Epson printer while comparing with my Xprinter print= er's USB device info. My Epson printer is providing vendor specific val= ues of 255 in the bInterfaceClass and bInterfaceSubClass respectively.<br><= /div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2=A0= =C2=A0 =C2=A0 bInterfaceClass =3D 0x00ff =C2=A0<Vendor specific><br>= =C2=A0 =C2=A0 =C2=A0 bInterfaceSubClass =3D 0x00ff</div><div class=3D"gmail= _quote"><br></div><div class=3D"gmail_quote">It should be a value of 7 for= =20 bInterfaceClass and a value of 1 in=20 bInterfaceSubClass. </div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2= =A0 =C2=A0 =C2=A0 bInterfaceClass =3D 0x0007 =C2=A0<Printer device><b= r>=C2=A0 =C2=A0 =C2=A0 bInterfaceSubClass =3D 0x0001</div><div class=3D"gma= il_quote"><br></div><div class=3D"gmail_quote">So, the ulpt_attach() routin= e below will break upon validation for mismatched values in=20 UICLASS_PRINTER and=C2=A0 UISUBCLASS_PRINTER. </div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 } else {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 alt_index++;<br>=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((id->bInterfaceClass =3D=3D UICLA= SS_PRINTER) &&<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (id->bInterfaceSubClass =3D=3D UISUBCLASS_PRINTER) &&<br>=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (id->bInterfaceProtocol= =3D=3D UIPROTO_PRINTER_BI)) {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 goto found;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 }<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 }</div><div class=3D"gmail_quote"><br></div><div class=3D= "gmail_quote">What I did is temporarily replace these values in the USB def= inition. In this case, how should the project handle this non-compliance US= B devices? Though I will raise this to Epson if they could provide an updat= ed firmware.<br></div><div class=3D"gmail_quote"><br></div><div class=3D"gm= ail_quote">freebsd@generic:~ % diff -Nur /usr/src/sys/dev/usb/usb.h.orig /u= sr/src/sys/dev/usb/usb.h<br>--- /usr/src/sys/dev/usb/usb.h.orig =C2=A0 =C2= =A0 2022-03-27 02:55:01.319235000 +0800<br>+++ /usr/src/sys/dev/usb/usb.h = =C2=A02022-03-27 02:57:10.608518000 +0800<br>@@ -459,8 +459,10 @@<br>=C2=A0= #define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_PHYSICAL =C2=A0 =C2=A0 =C2=A0 = =C2=A00x05<br>=C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_IMAGE =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x06<br>=C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2= =A0UISUBCLASS_SIC =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01 =C2=A0 =C2=A0 =C2=A0 = /* still image class */<br>-#define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_PRIN= TER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x07<br>-#define =C2=A0 =C2=A0 =C2=A0 =C2= =A0UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A01<br>+/* #define =C2=A0 =C2=A0 UI= CLASS_PRINTER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x07 */<br>+/* #define =C2=A0 =C2= =A0 UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A01 */<br>+#define =C2=A0 =C2=A0 = =C2=A0 =C2=A0UICLASS_PRINTER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0xff<br>+#define = =C2=A0 =C2=A0 =C2=A0 =C2=A0UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A00xff</div= ><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">I can prin= t now with ulpt(4) driver but need further testing for any issues.<br></div= ><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">ugen1.5: &= lt;EPSON EPSON UB-U03II> at usbus1<br>ulpt0 on uhub1<br>ulpt0: <EPSON= EPSON UB-U03II, class 0/0, rev 1.10/2.00, addr 5> on usbus1<br>ulpt_att= ach: setting alternate config number: 0<br>ulpt0: using bi-directional mode= </div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">Thank= s,</div><div class=3D"gmail_quote">Archimedes <br></div><div class=3D"gmail= _quote"><br></div><div class=3D"gmail_quote"><br></div></div> --0000000000007d718f05db2cd7d3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJFbk7GAz44pwFUdYQJKMfDA1EXZ%2BJSqYCxeRyuCaYk-u%2BiPNw>