Completion routine isn't called when reading from a interrupt pipe

Discussion in 'Windows Vista Drivers' started by Edgard Lima, Oct 22, 2004.

  1. Edgard Lima

    Edgard Lima Guest

    Hi all,

    I'm trying to get my function "OnInterrupt" called when I touch the device,
    but my functions isn't called. My "OnInterrupt" function is only called when
    I remove the device, because the irp is cancelled.

    Do anyone could help me to know why Completion routine "OnInterrupt" isn't
    called.

    I'm trying to read from a interrupt pipe.
    I'm very very worried because I really can wonder what is going wrong.

    Thanks very much
    Edgard Lima

    // Initialize the URB we use for reading the interrupt pipe
    UsbBuildInterruptOrBulkTransferRequest(urb,
    sizeof(_URB_BULK_OR_INTERRUPT_TRANSFER),
    pdx->pipeIn81, &pdx->intdata, NULL, 8, USBD_TRANSFER_DIRECTION_IN |
    USBD_SHORT_TRANSFER_OK, NULL);

    // Install "OnInterrupt" as the completion routine for the polling IRP.
    IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) OnInterrupt, pdx, TRUE,
    TRUE, TRUE);
    PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp);
    stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
    stack->Parameters.DeviceIoControl.IoControlCode =
    IOCTL_INTERNAL_USB_SUBMIT_URB;
    stack->Parameters.Others.Argument1 = urb;

    status = IoCallDriver(pdx->LowerDeviceObject, Irp);
    KdPrint(("pIrp = %X, status = %X, Irp->IoStatus.Status = %X, USBDstatus =
    %X\n", Irp, status, Irp->IoStatus.Status, URB_STATUS(pdx->PollingUrb)));

    output from KdPrint
    pIrp = 86FB8F00
    status = 103
    Irp->IoStatus.Status = 103
    USBDstatus = 40000000
     
    Edgard Lima, Oct 22, 2004
    #1
    1. Advertisements

  2. Edgard Lima

    Walter Oney Guest

    It looks like you're doing everything right, and you would not be seeing
    the IRP cancellation if you weren't. Is it possible that the device is
    not actually responding to IN transactions when you think it should be?
     
    Walter Oney, Oct 22, 2004
    #2
    1. Advertisements

  3. Adding to Walter's coments...

    This scenario is almost always due to the device doing one of the following:
    1. Device isn't sending any data
    2. Device isn't ending transfer in a short (or zero-length) transfer. For
    this you may want to check the endpoint's MaxPacket. You may be trying to
    read more than MaxPacket, and the device sends a full MaxPacket of data.
    This will not complete a transfer. The device could be assuming that the
    driver will be requesting a specific number of bytes and thus does not issue
    a zero-length transfer.
    3. Device is out of sync with the data toggle. This is pretty common for
    new USB devices during development. If the device's data toggle is not what
    the host expects it to be, the data is thrown away.

    I hope this helps.

    Randy
     
    Randy Aull \(MSFT\), Oct 22, 2004
    #3
  4. Edgard Lima

    Edgard Lima Guest

    Hi Walter,

    I'm using a driver almost like the int42 sample from your book (2snd
    edition).
    And every thing seems to be right.
    But, Would it (this unexpected behaviour) be possible because the way I'm
    istalling the driver?
    My device is a touch-screen HID USB device. And I haven't certified it yet
    (WQHL) so I've to do some tricks in the Device Manager to put my driver
    working instead of the default windows hid driver.
    What do you think?

    Thanks again,
    Edgard
     
    Edgard Lima, Oct 22, 2004
    #4
  5. It doesn't sound like installation would be the problem since you are seeing
    the URB get cancelled.

    Why does your device require you to write a driver if it is a HID USB
    device? Windows already supports USB HID devices.

    Randy

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.


     
    Randy Aull \(MSFT\), Oct 22, 2004
    #5
  6. Edgard Lima

    Edgard Lima Guest

    Hi Randy,

    Because unfortunatelly the device has more features than HID can support.
    :-(

    But, I think you and Walter are right....I'll (now I'm sure it isn't the
    intallation) investigate more my device, it worked once and I'll check what
    is happennig.

    Thanks a lot.
    Edgard Lima



     
    Edgard Lima, Oct 22, 2004
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.