none
How does KMDF driver control the master volume of Windows? RRS feed

  • Question

  • Dear Sirs:

    I am developing a KMDF codec driver. 

    One of features is that the user can press buttons which are attached on a headset to manipulate the render volume.

    Is there any windows API available to allow me to control the master volume of Windows under KMDF developmnet?

    Thanks a lot.

    Sincerely, 

    Zale Yu

    Monday, March 16, 2015 8:44 AM

Answers

  • these are typically exposed as HID volume controls which means you need to write an underlying bus driver to expose another device for the hid part

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

    Monday, March 16, 2015 2:26 PM
  • bus driver: best to start with a sample, go with the static bus sample in toaster. it is a wdf based driver which makes life pretty simple

    you can't bind to the KS/media stack as well as the HID stack in a driver, both are port drivers that take over the entire driver, they don't share nicely. this is why you need a bus driver to split each apart .


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

    Friday, April 3, 2015 6:32 AM

All replies

  • these are typically exposed as HID volume controls which means you need to write an underlying bus driver to expose another device for the hid part

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

    Monday, March 16, 2015 2:26 PM
  • Changing the master volume can be done from a driver using the Kernel Streaming APIs, but it is very difficult. It is also difficult from user mode, too (nothing is easy when dealing with audio)

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, March 20, 2015 7:12 AM
    Moderator
  • Hi Doron,

    Thank you for pointing out the direction. Here please allow me to ask two questions, and also please review a possible solution.

    Question: 

    - may I ask for more details on how to do this underlying bus driver? i.e. could you kindly list a few steps on how to do this? 

    - Any related samples available in MSDN WDF I can look at to get th idea/even reuse the code? 

    Possibl solution:

    - how about claiming the codec device as a HID devic as well, and make a minidriver to pass through IRPs to filter driver which captures/interprets the button-press interrupt and then send HID report to change system volume? is this feasible? any conflict: Can Kernal add th driver (now Codec function Driver, Mini driver and a HID filter driver all together) stack together -- so the right driver can process the packet interested?

    Thanks again.

    JerryWang.xw

    Thursday, April 2, 2015 6:26 PM
  • bus driver: best to start with a sample, go with the static bus sample in toaster. it is a wdf based driver which makes life pretty simple

    you can't bind to the KS/media stack as well as the HID stack in a driver, both are port drivers that take over the entire driver, they don't share nicely. this is why you need a bus driver to split each apart .


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

    Friday, April 3, 2015 6:32 AM
  • You don't need to be an audio port driver to make the necessary KS calls to control the master volume. I think all you'd need to do is enumerate the nodes to find the master volume pin and then send it the KS set property IRP for the volume property. It's been a while since I dealt with this stuff, so it may be a little more complicated, but this is the gist of what needs to be done to control the volume from a driver.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, April 3, 2015 9:54 PM
    Moderator