[wdmaudiodev] Re: Interfacing Audio Driver From USER MODE

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 02 Feb 2009 10:58:43 -0800

Vipin Kumar wrote:
> thanks tim,
>
>    But Mr. Mathew told me
>                 if you want to handle IRP_MJ_DEVICE_CONTROL,  you will
> have to handle the MJ_CREATE & MJ_CLOSE.

I *believe* he said that before we all knew that you were working with a
port-class driver.


> i just want some data to be passed from user mode to the audio driver,
> and i really don't want to make a mess out of the driver by putting
> highly complicated code.

Audio drivers are complicated.  There's just no way around it.


> i have registered my driver, using ioregisterinterface and  then
>                                
> IoSetDeviceInterfaceState(&InstanceString,TRUE);
>
> I use   SetupDiEnumDeviceInterfaces,
> SetupDiGetDeviceInterfaceDetail         to get my instance in user mode.
>
> but createfile returns me Filenotfound err code 2.

Right.  This is probably because the port class driver is already
defining and maintaining its own device interfaces, using the kernel
streaming standards.  Device interfaces are just aliases; when you open
that driver, the request goes to the same set of dispatch handlers that
port class defines for regular audio device use.  The file name in your
open request is, apparently, not in the format that port class wants.


>
>
> now let me try your approach, Kernel streaming one
>
> Now, i have opened up msvad simple, and i would like receive some
> data( 2KB)  from the user mode,
> So my questions are,
>       (i) Any samples available to transfer data from usermode to
> kernel mode.please point me

MSVAD already has a large number of property handlers, as do all of the
AVStream samples in the DDK.  Further, the DDK documentation on defining
and handling properties is pretty good.


>       (ii)  Do i have to define a new KSPROPERTY

Yes.  You should create a new KSPROPERTYSET for your custom properties,
then add individual KSPROPERTY definitions as you need additional
interfaces.


>      (iii) How to do the user mode part  , what should be done from
> user mode to send the calls?

I believe I have already said this at least twice in this thread. 
Instead of using SetupDi, you will use the "system device enumerator"
(CLSID_SystemDeviceEnum and ICreateDevEnum) to enumerate through the
list of audio devices and find your own.  When you find it, you will use
IMoniker::BindToObject to get an IBaseFilter that represents your
driver.  There are lots of samples on the web (and in the DirectShow
SDK) that describe this process.  It's the same process you use to find
a video camera in a capture application.

One you have an IBaseFilter, you just fetch an IKsControl interface from it:
    CComQIPtr<IKsControl> pKsControl( myFilter );

Then, you just use pKsControl->KsProperty to send the property requests,
exactly like calling DeviceIoControl with a file handle.

-- 
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: