I have been writing device drivers for the products that my company
manufactures for
about 10 years. There has not been a need to spend a lot of my time
updating the drivers, but
I found updates necessary and decided to update the drivers to KMDF.
I have updated the PCI Express and PCI cards' drivers and am now working
on the USB driver update.
I am very puzzled. I have carefully stepped through the sample code and
got the OsrUsbFX2
kit and have been reading the DDK documentation and the 'Developing
Drivers with the windows
Driver Foundation' book (very good book... adds a lot to the DDK docs).
Nothing I have found
helps me solve the problem that I am having.
I need to have my driver setup get to the Alternate interface #2, but
have NOT been able to get
past the initial (with default alt#0 configuration parameters)Interface
configuration call
so that I can proceed to switch to the desired Alternate config:
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&configParams);
status = WdfUsbTargetDeviceSelectConfig(UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES, &configParams );
... status gets set to 0xc0000001... (a non-descriptive
STATUS_UNSUCCESSFUL error)
About my USB device:
- One DEVICE descriptor.
- One CONFIGURATION descriptor (standard configuration) (0lh).
- One INTERFACE descriptor (standard interface) (00h).
- Three different alternate interfaces within the 00h interface:
a) 00h => Default 0 kbytes/sec interface. (/*Basically a "dumb"
interface... No ENDPOINTS*/)
b) Olh => Alternate 1 kbyte/sec interface. (Two endpoints...
InterruptIN and OUT)
c) 02h => Alternate 10 kbytes/sec interface. (Two endpoints...
InterruptIN and OUT)
This device sends small packets of CLOCK/TIME data when available via
the InterruptIN pipe (or at least
it will once I get the driver update working).
I have tried also to use the
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES
and WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS with
parameters that
have been setup to use Alternate#2 interface but still with no luck.
In my WDM driver (via SoftICE tools) I had been able to directly
initialize the Interface to Alternate#2.
Also, I am successful with the following calls prior to the above calls
in the EvtPrepareHardware section:
status = WdfUsbTargetDeviceCreate(Device, WDF_NO_OBJECT_ATTRIBUTES,
UsbDevice);
WDF_USB_DEVICE_INFORMATION_INIT(&deviceInfo);
status = WdfUsbTargetDeviceRetrieveInformation(UsbDevice, &deviceInfo);
numInterfaces = WdfUsbTargetDeviceGetNumInterfaces(UsbDevice); //
equals '1' in debug output as expected
UsbInterface = WdfUsbTargetDeviceGetInterface(UsbDevice, 0 );
//the number of alternate settings that the specified USB interface
supports
altSettings = WdfUsbInterfaceGetNumSettings(UsbInterface); // = 3
as expected (Alternate 0, 1 & 2) ... debug
// the interface number
interfaceNumber = WdfUsbInterfaceGetInterfaceNumber(UsbInterface); //
= 0 as expected... debug
numEndpoints = WdfUsbInterfaceGetNumEndpoints(UsbInterface, 0);
// = 0
numEndpoints1 = WdfUsbInterfaceGetNumEndpoints(UsbInterface, 1); //
= 2
numEndpoints2 = WdfUsbInterfaceGetNumEndpoints(UsbInterface, 2); //
= 2
What am I missing... (note the NO endpoints issue for default Alt#0)...
Can this be a reason and if so, what is the workaround?
I have spent the past week on this and trying all the possible ways to
get the initializations
done (in several different ways) prior to the call to SelectConfig.
My device sends CLOCK/TIME data packets as needed via the InterruptIN
pipe (or at least
it will once I get the driver update working). Any help or feedback
would be very appreciated.
Tracey