Subject: HP USB interface confuration error; quirk needed?
To: None <tech-kern@netbsd.org>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: tech-kern
Date: 06/25/2001 17:49:12
Today I purchased a HP 1200se printer, with the intent of setting it
up as my house's generic printer. As such, it'll spend most of its
life attached to a Windows box, but before consigning it to that fate
I wanted to see if I could print PostScript to it via the USB port on
my Alpha.

I was disappointed to see that it attached as ugen, not ulpt:

ugen0 at uhub1 port 4
ugen0: HewLett Packard HP LaserJet 1200, rev 1.10/1.00, addr 4

and then I started digging into why it didn't match ulpt. The USB
setup on my machine is as follows:

447 daffy-duck:nathanw>usbdevs 
addr 1: OHCI root hub, Opti
 addr 2: E-USB Bridge, Shuttle Technology Inc.
 addr 3: Standard USB Hub, vendor 0x03eb
  addr 4: HP LaserJet 1200, HewLett Packard

and the device's data, as reported by usbctl, is at the end of this
message.

Two things jumped out at me about the device data as compared with the
ulpt match routine:

First, the device reported interface 0 as
class=7/subclass=1/interface=3. ulpt supports 7/1/1 and 7/1/2, but not
7/1/3. A look at the USB printer spec (the one referenced in the
printer code is a couple of revisions behind) lists 7/1/3 as IEEE
1284.4, bidirectional, and notes that it's the same as bidirectional,
but with the guarantee that the protocol to the printer is IEEE
1284.4. It seems that adding this to the ulpt driver should be
trivial.

Second, the configuration descriptor listed "bNumInterface=1", but
then three interface descriptors followed. I think that this is
incorrect on the part of HP, but I'm not 100% sure about the semantics
of this bit of data.

Anyway, to deal with that incorrectness, I can see two approaches:

1) Ignore bNumInterfaces and use whatever mechanisim usbctl uses to
   iterate over interfaces.
2) Add a quirk code for "this device lies" and have a correct number.

Thoughts?

        - Nathan


463 daffy-duck:nathanw>usbctl -a 4 
DEVICE addr 4
DEVICE descriptor:
bLength=18 bDescriptorType=device(1) bcdUSB=1.10 bDeviceClass=0
bDeviceSubClass=0
bDeviceProtocol=0 bMaxPacketSize=8 idVendor=0x03f0 idProduct=0x0317
bcdDevice=100
iManufacturer=1(HewLett Packard) iProduct=2(HP LaserJet 1200)
iSerialNumber=3(00CNBQ068316) bNumConfigurations=1

CONFIGURATION descriptor 0:
bLength=9 bDescriptorType=config(2) wTotalLength=78 bNumInterface=1
bConfigurationValue=1 iConfiguration=0() bmAttributes=40 bMaxPower=2
mA

INTERFACE descriptor 0:
bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
bAlternateSetting=0
bNumEndpoints=3 bInterfaceClass=7 bInterfaceSubClass=1
bInterfaceProtocol=3 iInterface=0()

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-out
bmAttributes=bulk wMaxPacketSize=64 bInterval=0

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in
bmAttributes=bulk wMaxPacketSize=64 bInterval=0

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=2-in
bmAttributes=interrupt wMaxPacketSize=8 bInterval=255

INTERFACE descriptor 1:
bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
bAlternateSetting=1
bNumEndpoints=2 bInterfaceClass=7 bInterfaceSubClass=1
bInterfaceProtocol=2 iInterface=0()

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-out
bmAttributes=bulk wMaxPacketSize=64 bInterval=0

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in
bmAttributes=bulk wMaxPacketSize=64 bInterval=0

INTERFACE descriptor 2:
bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
bAlternateSetting=2
bNumEndpoints=1 bInterfaceClass=7 bInterfaceSubClass=1
bInterfaceProtocol=1 iInterface=0()

ENDPOINT descriptor:
bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-out
bmAttributes=bulk wMaxPacketSize=64 bInterval=0

current configuration 1

----------