Skip to contentSkip to conversation

usb printer driver and zero length transfer

DISCUSSION Kallol Biswas 2 participants 2 messages Mar 24, 2003 – Mar 25, 2003

lore
Share & tools
lore
#0 lore raw

Hi,
I am new to USB world and looking for clarification on usb
printer's
behavior when transferring data with size multiple of wMaxPacketSize.

I have been running redhat 7.1 (linux kernel 2.4.2-2) on x86 PC with a USB 1.1 controller. There is a target mode printer driver running on the

other side.

On the host the device file is /dev/usb/lp0.
If a data packet of 64 bytes is sent with

"cat data8 > /dev/usb/lp0" , the size of data8 is 64, a zero length packet
at the end of the transfer is not sent.

Is this a correct behavior? How do we force the printer driver send a zero length packet at the end of a transfer if the packet size is a multiple of wMAxPacketSize?

Kallol

#1 lore raw
Quoted 13 lines · Kallol Biswas

Hi,
I am new to USB world and looking for clarification on usb
printer's
behavior when transferring data with size multiple of wMaxPacketSize.

I have been running redhat 7.1 (linux kernel 2.4.2-2) on x86 PC with a USB 1.1 controller. There is a target mode printer driver running on the

other side.

On the host the device file is /dev/usb/lp0.
If a data packet of 64 bytes is sent with

Quoted 7 lines

"cat data8 > /dev/usb/lp0" , the size of data8 is 64, a zero length packet
at the end of the transfer is not sent.

Is this a correct behavior? How do we force the printer driver send a zero length packet at the end of a transfer if the packet size is a multiple of wMAxPacketSize?

If your device requires that a zero length packet be send for this situation, then modify the transfer flags of the urb with URB_ZERO_PACKET to cause this to happen.

Hope this helps,

greg k-h