From nobody Sun Mar 27 05:55:18 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EB85D1A385F2 for ; Sun, 27 Mar 2022 05:55:25 +0000 (UTC) (envelope-from archimedes.gaviola@gmail.com) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KR4ms0W8rz4Vfh for ; Sun, 27 Mar 2022 05:55:25 +0000 (UTC) (envelope-from archimedes.gaviola@gmail.com) Received: by mail-ej1-x62d.google.com with SMTP id bq8so8673660ejb.10 for ; Sat, 26 Mar 2022 22:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HDVRR9yg2PRDChbb+wTyQxK78Z13qms72CmYi/j9khA=; b=Em4Aaz9DT1Sh0tUtl+1GlpNxDEc2pn2sjlWmAUxv+a3D6g8iHqBfSjgt5im1+hH8GD YiNYYb95z0DKDpw2f7hob74EyMmVSzcjJsl48/p4hHBcM2cNe9lJwYatQikVTrcy/pD3 cjKnYR0mIRWDHZBGYuUw4D5SWNslYLqN8HhyaLZQ7NPBsNIjNXaB/rJGX+F45NAs97vh 8wLPMGUUx7eq+QwnP/OObiTmwwrByB2C2KeRh+8nk94jFakjXp80E8Ym0EA1P9/6HowX nJ3qngPnsvygOpjYfOrUNmgns2cUJ4yPGa/oUjpkAMv1kcUQFbFFz3IgGy8nNiYrVrE2 LrwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HDVRR9yg2PRDChbb+wTyQxK78Z13qms72CmYi/j9khA=; b=NATMMX/KzWerExxqd8IQzghVV1b1KUf43V8d7Ct0yg5chk5Eolx9UElXiqretFXaSP s9FWOF+jeSFChiimu6yOXEYocoFUuYph1l8mg4y97vjV+DSBpOA353NBm656QsuW3fSP F9bJfcgyfFzODcRZwskeQYbGVNfuBXJB3QfTehOvAPItQ2CAxWCE8JyWhRaIo6ZOYzzg YryDr58ChhuTrIOHR4JvHxTeT9RivGQPuSOl2wLziDE7hgElKbSD4IfAQd5dIGp3w6hD MIJH54TGY/Kx+BoKNhBlbQLy8GSr3tsyzQrWCyac4Od0HioQ5FTjs412D3ohtoDAgWdC qUog== X-Gm-Message-State: AOAM532kzzpPppsr/phCSGpvt6TjJSxZZK1g2MLqjbv+XI+EBkAvGlVN D3dmgmTwIj7ZZd46GGy0fo1Zg27ieuYeeWMMIJceIinNSoE= X-Google-Smtp-Source: ABdhPJxVkEOo0Qz8oj98P8sypqSvEI8ojqg5Wle9QAWw7gZdx162YkiIQSCFCxnLOvQXPJTKoEob4P7Bd9wEAifG+yM= X-Received: by 2002:a17:907:eac:b0:6db:799c:cb3c with SMTP id ho44-20020a1709070eac00b006db799ccb3cmr20929567ejc.559.1648360523918; Sat, 26 Mar 2022 22:55:23 -0700 (PDT) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 References: <7c67118e-f6ec-c87d-9a81-3ee6a5952f49@selasky.org> <60f98b10-dcdc-cdf4-3d7a-fe9fd4dff223@selasky.org> <8226461b-5740-9c19-0575-2740bd952e16@selasky.org> <5fcece51-b014-330e-b701-fd75fa1ac204@selasky.org> In-Reply-To: From: Archimedes Gaviola Date: Sun, 27 Mar 2022 13:55:18 +0800 Message-ID: Subject: Re: Raspberry Pi 3B USB Printing Issue To: Hans Petter Selasky Cc: freebsd-arm@freebsd.org Content-Type: multipart/alternative; boundary="0000000000007d718f05db2cd7d3" X-Rspamd-Queue-Id: 4KR4ms0W8rz4Vfh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Em4Aaz9D; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of archimedesgaviola@gmail.com designates 2a00:1450:4864:20::62d as permitted sender) smtp.mailfrom=archimedesgaviola@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62d:from]; MLMMJ_DEST(0.00)[freebsd-arm]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Status: O Content-Length: 8871 Lines: 183 --0000000000007d718f05db2cd7d3 Content-Type: text/plain; charset="UTF-8" On Sat, Mar 12, 2022 at 4:41 PM Hans Petter Selasky wrote: > On 3/12/22 08:07, Archimedes Gaviola wrote: > > ugen1.5: at usbus1 > > ulpt1 on uhub1 > > ulpt1: 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 > > 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 bInterfaceSubClass = 0x00ff It should be a value of 7 for bInterfaceClass and a value of 1 in bInterfaceSubClass. bInterfaceClass = 0x0007 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: at usbus1 ulpt0 on uhub1 ulpt0: 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


=
On Sat, Mar 12, 2022 at 4:41 PM Hans = Petter Selasky <hps@selasky.org&g= t; wrote:
On 3/1= 2/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 :
=C2=A0 =C2=A0 =C2=A0 12 ENOMEM Cannot allocate memory.

I guess the EPSON printer you've got is not compatible with ulpt<n&g= t;

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 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.
<= /div>

=C2=A0= =C2=A0 =C2=A0 bInterfaceClass =3D 0x00ff =C2=A0<Vendor specific>
= =C2=A0 =C2=A0 =C2=A0 bInterfaceSubClass =3D 0x00ff

It should be a value of 7 for= =20 bInterfaceClass and a value of 1 in=20 bInterfaceSubClass.

=C2= =A0 =C2=A0 =C2=A0 bInterfaceClass =3D 0x0007 =C2=A0<Printer device>=C2=A0 =C2=A0 =C2=A0 bInterfaceSubClass =3D 0x0001

So, the ulpt_attach() routin= e below will break upon validation for mismatched values in=20 UICLASS_PRINTER and=C2=A0 UISUBCLASS_PRINTER.

=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 {
=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++;
=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) &&
=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) &&
=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)) {
=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;
=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 }

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.

freebsd@generic:~ % diff -Nur /usr/src/sys/dev/usb/usb.h.orig /u= sr/src/sys/dev/usb/usb.h
--- /usr/src/sys/dev/usb/usb.h.orig =C2=A0 =C2= =A0 2022-03-27 02:55:01.319235000 +0800
+++ /usr/src/sys/dev/usb/usb.h = =C2=A02022-03-27 02:57:10.608518000 +0800
@@ -459,8 +459,10 @@
=C2=A0= #define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_PHYSICAL =C2=A0 =C2=A0 =C2=A0 = =C2=A00x05
=C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_IMAGE =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x06
=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 */
-#define =C2=A0 =C2=A0 =C2=A0 =C2=A0UICLASS_PRIN= TER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x07
-#define =C2=A0 =C2=A0 =C2=A0 =C2= =A0UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A01
+/* #define =C2=A0 =C2=A0 UI= CLASS_PRINTER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x07 */
+/* #define =C2=A0 =C2= =A0 UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A01 */
+#define =C2=A0 =C2=A0 = =C2=A0 =C2=A0UICLASS_PRINTER =C2=A0 =C2=A0 =C2=A0 =C2=A0 0xff
+#define = =C2=A0 =C2=A0 =C2=A0 =C2=A0UISUBCLASS_PRINTER =C2=A0 =C2=A0 =C2=A00xff

I can prin= t now with ulpt(4) driver but need further testing for any issues.

ugen1.5: &= lt;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_att= ach: setting alternate config number: 0
ulpt0: using bi-directional mode=

Thank= s,
Archimedes


--0000000000007d718f05db2cd7d3--