I'm currently writing a driver for the Philips eHome Infrared Transciever
based on the existing lirc_atiusb driver. Judging from USB Snoopy's
output on Windows XP, the windows driver gets two endpoints
with interrupt-style pipes after enumeration.

Strangely enough when trying to recreate the exat same thing on Linux
(2.6.8-24.11-default i686 SuSE) I only get two bulk-type pipes and
no interrupt-type pipes although configuration, interface and altSetting
seem to be identical.

Here's the output from USB Snoopy followed by the code snippet.

[0 ms] UsbSnoop compiled on Jan 18 2003 22:41:32 loading
[0 ms] UsbSnoop - DriverEntry(f7bf0c40) : Windows NT WDM version 1.32
[10 ms] UsbSnoop - AddDevice(f7bf0f50) : DriverObject 861b3a20, pdo 86275c48
[10 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_PNP (0x00000018)
[10 ms] UsbSnoop - MyDispatchPNP(f7bf0ee0) : IRP_MJ_PNP (0x00000018)
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_PNP
(IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
[11 ms] UsbSnoop - MyDispatchPNP(f7bf0ee0) : IRP_MJ_PNP
(IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_PNP
(IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
[11 ms] UsbSnoop - MyDispatchPNP(f7bf0ee0) : IRP_MJ_PNP
(IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_PNP
(IRP_MN_QUERY_CAPABILITIES)
[11 ms] UsbSnoop - MyDispatchPNP(f7bf0ee0) : IRP_MJ_PNP
(IRP_MN_QUERY_CAPABILITIES)
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_PNP (IRP_MN_START_DEVICE)
[11 ms] UsbSnoop - MyDispatchPNP(f7bf0ee0) : IRP_MJ_PNP (IRP_MN_START_DEVICE)
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[11 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_SYSTEM_CONTROL
[11 ms] UsbSnoop - MyDispatchInternalIOCTL(f7befe80) : fdo=86275c48,
Irp=8628faf8, IRQL=0
[11 ms]  >>>  URB 1 going down  >>> 
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000012
  TransferBuffer       = 8634e2b0
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000001 (USB_DEVICE_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[16 ms] UsbSnoop - MyInternalIOCTLCompletion(f7befdb0) :
fido=00000000, Irp=8628faf8, Context=8628d048, IRQL=2
[16 ms]  <<<  URB 1 coming back  <<< 
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 862690d0
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000012
  TransferBuffer       = 8634e2b0
  TransferBufferMDL    = 861e66d0
    00000000: 12 01 10 01 00 00 00 10 71 04 15 08 00 00 01 02
    00000010: 03 01
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 01 00 00 12 00
[16 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[16 ms] UsbSnoop - MyDispatchInternalIOCTL(f7befe80) : fdo=86275c48,
Irp=8628faf8, IRQL=0
[16 ms]  >>>  URB 2 going down  >>> 
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000009
  TransferBuffer       = 86240e50
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000002 (USB_CONFIGURATION_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[20 ms] UsbSnoop - MyInternalIOCTLCompletion(f7befdb0) :
fido=00000000, Irp=8628faf8, Context=862a2c98, IRQL=2
[20 ms]  <<<  URB 2 coming back  <<< 
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 862690d0
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000009
  TransferBuffer       = 86240e50
  TransferBufferMDL    = 861e66d0
    00000000: 09 02 20 00 01 01 00 a0 32
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 02 00 00 09 00
[20 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[20 ms] UsbSnoop - MyDispatchInternalIOCTL(f7befe80) : fdo=86275c48,
Irp=8628faf8, IRQL=0
[20 ms]  >>>  URB 3 going down  >>> 
-- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  TransferBufferLength = 00000020
  TransferBuffer       = 863477f8
  TransferBufferMDL    = 00000000
  Index                = 00000000
  DescriptorType       = 00000002 (USB_CONFIGURATION_DESCRIPTOR_TYPE)
  LanguageId           = 00000000
[25 ms] UsbSnoop - MyInternalIOCTLCompletion(f7befdb0) :
fido=00000000, Irp=8628faf8, Context=862432c0, IRQL=2
[25 ms]  <<<  URB 3 coming back  <<< 
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 862690d0
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN,
USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000020
  TransferBuffer       = 863477f8
  TransferBufferMDL    = 861e66d0
    00000000: 09 02 20 00 01 01 00 a0 32 09 04 00 00 02 ff ff
    00000010: ff 00 07 05 01 02 10 00 00 07 05 81 02 10 00 00
  UrbLink              = 00000000
  SetupPacket          =
    00000000: 80 06 00 02 00 00 20 00
[25 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[25 ms] UsbSnoop - MyDispatchInternalIOCTL(f7befe80) : fdo=86275c48,
Irp=8628faf8, IRQL=0
[25 ms]  >>>  URB 4 going down  >>> 
-- URB_FUNCTION_SELECT_CONFIGURATION:
  ConfigurationDescriptor = 0x863477f8 (configure)
  ConfigurationDescriptor : bLength             = 9
  ConfigurationDescriptor : bDescriptorType     = 0x00000002
  ConfigurationDescriptor : wTotalLength        = 0x00000020
  ConfigurationDescriptor : bNumInterfaces      = 0x00000001
  ConfigurationDescriptor : bConfigurationValue = 0x00000001
  ConfigurationDescriptor : iConfiguration      = 0x00000000
  ConfigurationDescriptor : bmAttributes        = 0x000000a0
  ConfigurationDescriptor : MaxPower            = 0x00000032
  ConfigurationHandle     = 0x00000000
  Interface[0]: Length            = 56
  Interface[0]: InterfaceNumber   = 0
  Interface[0]: AlternateSetting  = 0
[85 ms] UsbSnoop - MyInternalIOCTLCompletion(f7befdb0) :
fido=00000000, Irp=8628faf8, Context=862e2c48, IRQL=0
[85 ms]  <<<  URB 4 coming back  <<< 
-- URB_FUNCTION_SELECT_CONFIGURATION:
  ConfigurationDescriptor = 0x863477f8 (configure)
  ConfigurationDescriptor : bLength             = 9
  ConfigurationDescriptor : bDescriptorType     = 0x00000002
  ConfigurationDescriptor : wTotalLength        = 0x00000020
  ConfigurationDescriptor : bNumInterfaces      = 0x00000001
  ConfigurationDescriptor : bConfigurationValue = 0x00000001
  ConfigurationDescriptor : iConfiguration      = 0x00000000
  ConfigurationDescriptor : bmAttributes        = 0x000000a0
  ConfigurationDescriptor : MaxPower            = 0x00000032
  ConfigurationHandle     = 0x8630dc38
  Interface[0]: Length            = 56
  Interface[0]: InterfaceNumber   = 0
  Interface[0]: AlternateSetting  = 0
  Interface[0]: Class             = 0x000000ff
  Interface[0]: SubClass          = 0x000000ff
  Interface[0]: Protocol          = 0x000000ff
  Interface[0]: InterfaceHandle   = 0x861db800
  Interface[0]: NumberOfPipes     = 2
  Interface[0]: Pipes[0] : MaximumPacketSize = 0x00000010
  Interface[0]: Pipes[0] : EndpointAddress   = 0x00000001
  Interface[0]: Pipes[0] : Interval          = 0x00000001
  Interface[0]: Pipes[0] : PipeType          = 0x00000003
(UsbdPipeTypeInterrupt)
  Interface[0]: Pipes[0] : PipeHandle        = 0x861db81c
  Interface[0]: Pipes[0] : MaxTransferSize   = 0x00001000
  Interface[0]: Pipes[0] : PipeFlags         = 0x00000000
  Interface[0]: Pipes[1] : MaximumPacketSize = 0x00000010
  Interface[0]: Pipes[1] : EndpointAddress   = 0x00000081
  Interface[0]: Pipes[1] : Interval          = 0x00000001
  Interface[0]: Pipes[1] : PipeType          = 0x00000003
(UsbdPipeTypeInterrupt)
  Interface[0]: Pipes[1] : PipeHandle        = 0x861db83c
  Interface[0]: Pipes[1] : MaxTransferSize   = 0x00001000
  Interface[0]: Pipes[1] : PipeFlags         = 0x00000000
[85 ms] UsbSnoop - DispatchAny(f7bee610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[85 ms] UsbSnoop - MyDispatchInternalIOCTL(f7befe80) : fdo=86275c48,
Irp=8628faf8, IRQL=0

Am I right in the assumption that everything up to here is part of the
enumeration
process? Is Linux doing something differently here that may cause the problem?

Here's what I do after enumration (almost verbatim from the atiusb driver):

static int usb_remote_probe(struct usb_interface *intf,
                                const struct usb_device_id *id)
{
        struct usb_device *dev = interface_to_usbdev(intf);
        struct usb_host_interface *idesc;

        struct usb_endpoint_descriptor *ep=NULL, *ep_in=NULL, *ep_out=NULL;
        struct usb_host_config *config;
        struct irctl *ir = NULL;
        struct lirc_plugin *plugin = NULL;
        struct lirc_buffer *rbuf = NULL;
        int devnum, pipe, maxp, len, buf_len, bytes_in_key;
        int minor = 0;
        int i;
        char buf[63], name[128]="";
        int mem_failure = 0;

        dprintk(DRIVER_NAME ": usb probe called\n");

        config=dev->actconfig;
        dprintk(DRIVER_NAME ": current configuration %d, current interface
%d, num endpoints
%d\n",config->desc.bConfigurationValue,intf->cur_altsetting->desc.bInterfaceNumber,intf->cur_altsetting->desc.bNumEndpoints);

        idesc = intf->cur_altsetting;

        for (i = 0; i < idesc->desc.bNumEndpoints; ++i) {
                ep = &idesc->endpoint[i].desc;

                dprintk("endpoint: length 0x%x descriptortype - 0x%x 
endpointaddress
- 0x%x attributes 0x%x - packetsize 0x%x - interval 0x%x\n",
ep->bLength, ep->bDescriptorType, ep->bEndpointAddress,
ep->bmAttributes, ep->wMaxPacketSize, ep->bInterval);

                if ((ep_in == NULL)
                        && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == 
USB_DIR_IN)
                        && ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT)) {

                        dprintk(DRIVER_NAME ": acceptable inbound endpoint 
found\n");
                        ep_in = ep;
                }

                if ((ep_out == NULL)
                        && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == 
USB_DIR_OUT)
                        && ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT)) {

                        dprintk(DRIVER_NAME ": acceptable outbound endpoint 
found\n");
                        ep_out = ep;
                }
        }
        if (ep_in == NULL) {
                dprintk(DRIVER_NAME ": no acceptable endpoint found\n");
#ifdef KERNEL_2_5
                return -ENODEV;
#else
                return NULL;
#endif
        }
...
}

And here's the debug output after plugging in the device:

Feb 15 00:00:15 hanf kernel: usb 3-2: new full speed USB device using address 3
Feb 15 00:00:15 hanf kernel: usb 3-2: Product: eHome Infrared Transceiver
Feb 15 00:00:15 hanf kernel: usb 3-2: Manufacturer: Philips
Feb 15 00:00:15 hanf kernel: usb 3-2: SerialNumber: PH001j68
Feb 15 00:00:21 hanf kernel: module lirc_philipsusb unsupported by
SUSE/Novell, tainting kernel.
Feb 15 00:00:21 hanf kernel:
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: USB remote driver for LIRC v0.1
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: Martin Blatter <[EMAIL PROTECTED]>
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: debug mode enabled
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: usb probe called
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: current configuration 1,
current interface 0, num endpoints 2
Feb 15 00:00:21 hanf kernel: endpoint: length 0x7 descriptortype - 0x5
endpointaddress - 0x1 attributes 0x2 - packetsize 0x10 - interval 0x0
Feb 15 00:00:21 hanf kernel: endpoint: length 0x7 descriptortype - 0x5
endpointaddress - 0x81 attributes 0x2 - packetsize 0x10 - interval 0x0
Feb 15 00:00:21 hanf kernel: lirc_philipsusb: no acceptable endpoint found
Feb 15 00:00:21 hanf kernel: usbcore: registered new driver lirc_philipsusb

In another desperate attempt, I tried to send the three
USB_REQ_GET_DESCRIPTOR control
messages that appear in the USB Snoopy log. To no avail. They went
through fine but
still no interrupt pipes, just bulk.

What am I doing wrong?

martin


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to