Re: Fucntional USB driver launching USBPRINT with error. by Doron
Doron
Thu Sep 23 01:48:52 CDT 2004
set a bp on your start handler. Look up the stack and set a bp in usbprint
where it called IoCallDriver, set a bp on the return and then hit g. then
debug instruction by instruction why usbprint is failing the start irp. you
will get a remove immediately after start if the start fails at any layer in
the stack. Query legacy bus info is not at play here, perhaps there is a
irp_mn_query_interface you are not handling.
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lars-Åke Berg" <lars-ake.berg@nibland.org> wrote in message
news:e9tAw7OoEHA.3396@tk2msftngp13.phx.gbl...
> Doran and others,
> I don't think any URB's have been sent yet. I track every possible path
> with
> DBG prints.
> When I compare the 'real' PDO with the Virtual PDO in the DeviceManager
> (Device Info tab enabled with a environment variable) I see one
> difference.
> The Busrelations field is the only field where the two drivers information
> doesn't match (except on those places they should. At the end of Device ID
> etc.)
> My 'real' PDO says = USB\Vid_xxxx&Pid_000f\6&6152815&3&1
> and my virtual PDO says = <empty string>.
>
> If I need to mirror the Busrelation information how do I do that? The
> IRP_MN_QUERY_LEGACY_BUS_INFORMATION is not a documented function call.
> Now I only do like this:
> --- A paste from a switch statement
> case 0x18: // IRP_MN_QUERY_LEGACY_BUS_INFORMATION
> IncOutstandingIO(pDevExt);
> IoSkipCurrentIrpStackLocation(pIrp);
> status = CallNextDriverSync(pDevExt, pIrp);
> DecOutstandingIO(pDevExt);
> break;
>
> // Breaks ends up here
> pIrp->IoStatus.Status = status;
> IoCompleteRequest(pIrp, IO_NO_INCREMENT);
> DecOutstandingIO(pDevExt); // An Inc was made when entering the Dispatch
> before the switch statement.
>
> return status;
> -----------------
> The IRP_MN_START_DEVICE do return status SUCCESS as a return value and in
> IoStatus.status so it's nothing wrong there (I have checked 100 times
> since
> you mentioned it).
>
> The behavior of the higher driver USBPRINT is that it collects all
> information possible from the Virtual PDO and then send and
> IRP_MN_START_DEVICE and then an IRP_MN_REMOVE_DEVICE with no command
> inbetween.
>
> This is driving me nuts soon,
> Lars-Åke Berg
>
>
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> skrev i meddelandet
> news:ehfFdI5nEHA.556@tk2msftngp13.phx.gbl...
>> i would hazard a guess that usbprint is failing start device. are you
>> setting the status in the irp as well as returning STATUS_SUCCESS? if
>> so,
>> something you are emulating is not being emulated correctly b/c usbprint
>> expects it, but is not present or functional. maybe it is a registry
> value
>> it expects from the class installer, maybe it is URB traffic.
>>
>> d
>>
>> --
>> Please do not send e-mail directly to this alias. this alias is for
>> newsgroup purposes only.
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>>
>> "Lars-Åke Berg" <lars-ake.berg@nibland.org> wrote in message
>> news:eKfaSP1nEHA.3172@TK2MSFTNGP10.phx.gbl...
>> > All please help me to solve this to me tricky problem.
>> > I have an USB printer which don't report the correct class id. The
> printer
>> > reports USB\Class_ff and my driver replaces this string with
> USB\Class_07
>> > when enumerated.
>> > This makes the USBPRINT system to launch exactly as I want, until USB
>> > print
>> > starts the PDO.
>> > In my PDO (I call it my Virtual PDO due to the fact it tunnels all
> trafik
>> > down to the real PDO which has the wrong class id) IRP_MN_START_DEVICE
>> > I
>> > complete the IRP and returns STATUS_SUCCESS. I then expect USBPRINT to
> be
>> > started, but no way. USBPRINT send an IRP_MN_REMOVE_DEVICE, why?????
> This
>> > makes every thing fail.
>> > What have I forgotten in my IRP_MN_START_DEVICE so that USBPRINT
>> > doesn't
>> > send a remove device IRP?
>> >
>> > Below is the dbg print from WindDbg. The PDO dispatch is in the file
> pdo.c
>> > which is called after device relations have been served by pnp.c (FDO
>> > dispatch).
>> >
>> > lkd> !dbgprint
>> > 'USBLarsa-2> DriverEntry
>> > 'USBLarsa-2> AddDevice: drvObj=82295D28h, pdo=8205D9B8h
>> > 'USBLarsa-2> CreateOurVirtual: drvObj=82295D28h, pdo=8205D9B8h
>> > virtualpdo=8229EE80h
>> > 'USBLarsa-2> pnp.c - IRP_MN_QUERY_LEGACY_BUS_INFORMATION
>> > 'USBLarsa-2> pnp.c - IRP_MN_QUERY_RESOURCE_REQUIREMENTS
>> > 'USBLarsa-2> pnp.c - IRP_MN_FILTER_RESOURCE_REQUIREMENTS
>> > 'USBLarsa-2> pnp.c - IRP_MN_START_DEVICE
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pnp.c - IRP_MN_QUERY_CAPABILITIES
>> > 'USBLarsa-2> pnp.c - IRP_MN_QUERY_PNP_DEVICE_STATE
>> > 'USBLarsa-2> pnp.c - IRP_MN_QUERY_DEVICE_RELATIONS
>> > 'USBLarsa-2> Relation string : BusRelations
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_ID
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_CAPABILITIES
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_DEVICE_TEXT
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_DEVICE_TEXT
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_ID
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_ID
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_ID
>> > 'USBLarsa-2> DoQueryID_PDO
>> > 'USBLarsa-2> BusQueryCompatibleIDs
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_RESOURCE_REQUIREMENTS
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_BUS_INFORMATION
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_RESOURCES
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_CAPABILITIES
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_LEGACY_BUS_INFORMATION
>> > 'USBLarsa-2> pdo.c - IRP_MN_QUERY_RESOURCE_REQUIREMENTS
>> > 'USBLarsa-2> CallNextDriverSync
>> > 'USBLarsa-2> CallDriverSync
>> > 'USBLarsa-2> CallDriverSyncCompletion
>> > 'USBLarsa-2> pdo.c - IRP_MN_FILTER_RESOURCE_REQUIREMENTS
>> > 'USBLarsa-2> pdo.c - IRP_MN_START_DEVICE
>> > 'USBLarsa-2> pdo.c - IRP_MN_REMOVE_DEVICE
>> >
>> >
>>
>>
>
>