Re: Raspberry Pi 3B USB Printing Issue

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Thu, 10 Mar 2022 07:47:42 UTC
On 3/10/22 00:24, Archimedes Gaviola wrote:
> On Thu, Mar 10, 2022 at 4:14 AM Hans Petter Selasky <hps@selasky.org> wrote:
> 
>> On 3/9/22 18:55, Archimedes Gaviola wrote:
>>> Hi,
>>>
>>> I have an Epson printer connected to one of the USB ports of my RPi 3B.
>> The
>>> printer is detected as a ugen(4) driver and then I have a text file -
>>> myfile3.txt which contains 10 lines of repeating sentences.
>>>
>>> freebsd@generic:~ % dmesg | grep EPSON
>>> ugen1.4: <EPSON EPSON UB-U03II> at usbus1
>>>
>>> freebsd@generic:~ % cat myfile3.txt
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>> The quick brown fox jumps over the lazy dog.
>>>
>>> freebsd@generic:~ % cat myfile3.txt  > /dev/usb/1.4.1
>>>
>>> I print the file successfully through device file redirection with cat
>>> command as described above. However, there were times that printing
>> seemed
>>> to suspend and withhold especially when my RPi 3B system got idle for
>> some
>>> period of time. Suspended or withhold in such a way that out of the 10
>>> lines there were only 2-3 lines to be printed in the paper. So, the only
>>> remedy I have for now is to reboot the system to be able to get back to
>>> normal printing. I'm using the 14.0-CURRENT #0 main-n253384-45c23c2608e:
>>> Thu Feb 24 09:18:58 UTC 2022 and my RPi 4B does not manifest this
>> behavior
>>> using this same 14.0-CURRENT version. Any idea what's going on?
>>>
>>> I found these sysctl knobs thinking if some tweaks would help but not
>> sure
>>> what are the exact settings beyond these defaults.
>>>
>>> hw.usb.timings.port_resume_delay: 40
>>> hw.usb.timings.port_powerup_delay: 300
>>> hw.usb.timings.port_reset_recovery: 10
>>> hw.usb.timings.port_root_reset_delay: 200
>>> hw.usb.timings.port_reset_delay: 50
>>>
>>> (Resend this message without dmesg and sysctl outputs as files are quite
>>> big, sorry I didn't notice it.)
>>>
>>
>> Hi,
>>
>> Why are you not using /dev/ulpt<N> ?
>>
>> /dev/usb/1.4.1 is the raw BULK endpoint.
>>
> 
> 
> Hi Hans,
> 
> The ulpt(4) driver isn't detected with this Epson printer. Only my other
> printer which is an Xprinter brand is able to get detected with ulpt(4).
> 

Hi,

Is it correctly detected if you the VID and PID to 
/usr/src/sys/dev/usb/serial/ulpt.c ?

When you use the printer via the BULK endpoint, there might be a missing 
flush packet, to flush all the printed text. This happens when the 
payload length is a multiple of the wMaxPacketSize.

--HPS