smartcard reader kmdf .sys with multiple device interface

Discussion in 'Windows Vista Drivers' started by moulefrite, Feb 11, 2011.

  1. moulefrite

    moulefrite

    Joined:
    Feb 11, 2011
    Messages:
    1
    Likes Received:
    0
    Hello everybody,
    I try to develop a smartcard reader USB driver.
    1) evtDeviceAdd :
    _ I have created an usb target device, for catch usb interrupt.
    _ I call WdfDeviceInitSetFileObjectConfig (EvtDeviceFileCreate) with a fileSlot context that contains all parameter needed for a slot interface smartcard.
    _ I call twice "WdfDeviceCreateDeviceInterface" ( for 2 smartcard slot interface )

    2) EvtDeviceD0Entry :
    _ Start interruptPipe target for catch interrupt message

    3) EvtDeviceFileCreate :
    _ with "FileOject" I extract fileSlot context attached to my device interface.

    When I launch a smartcard tool, I can see both interface.

    Now I have a problem for distinguish what is the deviceinterface affected by the usb interrupt.
    For example : the interruptPipe returned me 2 bytes (value 0x50, 0x0, 0x0, 0x0 )
    If value is : (value 0x50, 0x0, 0x0, 0xFF ) : Slot 1 is concerned ( devInterface0)
    If value is : (value 0x50, 0x0, 0xFF, 0x0 ) : Slot 2 is concerned ( devInterface1)

    In Interrupt completionRoutine, I would like to know how to communicate directly with devInterface concerned ( for change status smartcard = detected ) ?

    some one could give me any tips,
    if I can use a WdfIoTarget during DeviceFileCreate function that point to the WdfFileObject input parameter ?
    or use an array in deviceContext that contains both wdffileObject pointer ?

    deviceContext
    {
    WDFUSBDEVICE UsbDevice;
    WDFUSBPIPE pipeRead;
    WDFUSBPIPE pipeWrite;
    WDFUSBPIPE pipeInterrupt;

    WDFQUEUE ioctlQueue;
    } DEVICE_CONTEXT;

    fileSlotContext
    {
    PSMARTCARD_EXTENSION smartcardExtension; // for each deviceInterface
    UNICODE_STRING slotInterfaceName; // Slot0, Slot1, ....
    UCHAR deviceSlotNumber // 0,1, ....
    }

    Thanks in advance,

    Best regards,

    Moulefrite
     
    moulefrite, Feb 11, 2011
    #1
    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.