From nobody Sun Mar 27 08:04:52 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 EFED11A417B9 for ; Sun, 27 Mar 2022 09:05:24 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KR90334X9z4tjC for ; Sun, 27 Mar 2022 09:05:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from [10.36.2.165] (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0995D260754; Sun, 27 Mar 2022 11:05:13 +0200 (CEST) Message-ID: Date: Sun, 27 Mar 2022 10:04:52 +0200 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 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Raspberry Pi 3B USB Printing Issue Content-Language: en-US To: Archimedes Gaviola Cc: freebsd-arm@freebsd.org 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> From: Hans Petter Selasky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4KR90334X9z4tjC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.26 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.980]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-0.98)[-0.982]; MLMMJ_DEST(0.00)[freebsd-arm]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 3/27/22 07:55, Archimedes Gaviola wrote: > 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 > Hi, I think you can just extend that piece of code to accept either value using a boolean OR, ||. --HPS