Discussion:
Get "sound device names" from "device instance Ids" programaticall
(too old to reply)
jcec
2010-02-04 12:22:05 UTC
Permalink
Hi,

How can I get programatically "sound device names" (XP), "friendly
names" and "descriptions" (Seven) from the "device instance IDs" such as
devcon shows me ?

Explaining better:

I have two USB handsets of the same model plugged in my PC.
I already know that USB vendor ID for those handsets is 06E6, so I run
devcon in a command prompt asking for all the USB devices of that vendor and
I get the following list of "device instance IDs":

C:\PUBLIC\devcon\i386>devcon find usb\vid_06e6*
USB\VID_06E6&PID_F210\222648291361 : USB Composite
Device
USB\VID_06E6&PID_F210\5&4A29751&0&5 : USB Composite
Device
USB\VID_06E6&PID_F210&MI_00\6&15F2C20&0&0000 : USB Audio
Device
USB\VID_06E6&PID_F210&MI_00\6&1AFD3EB&0&0000 : USB Audio
Device
USB\VID_06E6&PID_F210&MI_03\6&15F2C20&0&0003 : USB Human
Interface Device
USB\VID_06E6&PID_F210&MI_03\6&1AFD3EB&0&0003 : USB Human
Interface Device
6 matching device(s) found.


If I am running Windows XP I can read (via Control Panel) the following
"sound device names" for the 2 handsets, for both mic and spkr devices:
"USB audio device"
"USB audio device (2)"

If I am running Windows 7 I can read (via Control Panel) the following
"sound device names" for the 2 handsets, for mic and spkr devices:
"Handset" and "USB audio device" (can we call them "friendly
name" and "description" ?)
"Handset" and "2- USB audio device" (can we call them "friendly
name" and "description" ?)

So, how can I get programatically the above "sound device names" (XP),
"friendly names" and "descriptions" (Seven) from the "device instance IDs" ?

Many thanks.
Alessandro Angeli
2010-02-04 18:40:37 UTC
Permalink
From: "jcec"
Post by jcec
USB\VID_06E6&PID_F210\222648291361
: USB Composite Device
I don't know of any API, but it's an easy DIY job, since
what you are referring to ad dev IDs is nothing more than
the relative path of the device reg key under
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum], e.g.:

HKEY_LOCAL_MACHINE
\SYSTEM
\CurrentControlSet
\Enum
\USB
\VID_06E6&PID_F210
\222648291361

What you are referring to as dev name in XP is the
"DeviceDesc" REG_SZ value under the dev reg key. There are
other info in there as well, like the dev class name and
GUID (you can get a friendly name for the class by looking
up the default value of the class GUID under
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class])
and other descriptive strings.

I haven't a Win7 to check, but you should find the
descriptions in the same place (since it's worked this way
since the dawn of times).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Francois PIETTE
2010-02-05 06:53:08 UTC
Permalink
Post by jcec
How can I get programatically "sound device names" (XP), "friendly
names" and "descriptions" (Seven) from the "device instance IDs" such as
devcon shows me ?
Have a look there:
http://msdn.microsoft.com/en-us/library/ms790392.aspx

You can call waveInGetNumDevs to know how many (count) sound devices the
system has.
The you can loop thru all DevID (from 0 to count-1) and call
waveInGetDevCaps to get the structure containing the product name, and call
waveInMessage passing DRV_QUERYDEVICEINTERFACE to get the interface name
(The interface name comes from the registry).

Similar function with waveOut.

Hope this helps.
--
***@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
jcec
2010-02-08 23:11:02 UTC
Permalink
waveInMessage() has two parameters: dwParam1 and dwParam2. I could not get
any documentation that tells their meaning for each case of the parameter
uMsg (in our case DRV_QUERYDEVICEINTERFACE )

Do you know of such a documentation or the values to use for this specific
case ?

Thanks.
Post by Francois PIETTE
Post by jcec
How can I get programatically "sound device names" (XP), "friendly
names" and "descriptions" (Seven) from the "device instance IDs" such as
devcon shows me ?
http://msdn.microsoft.com/en-us/library/ms790392.aspx
You can call waveInGetNumDevs to know how many (count) sound devices the
system has.
The you can loop thru all DevID (from 0 to count-1) and call
waveInGetDevCaps to get the structure containing the product name, and call
waveInMessage passing DRV_QUERYDEVICEINTERFACE to get the interface name
(The interface name comes from the registry).
Similar function with waveOut.
Hope this helps.
--
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
.
Francois PIETTE
2010-02-10 10:49:59 UTC
Permalink
Post by jcec
waveInMessage() has two parameters: dwParam1 and dwParam2.
The first is a widechar buffer to hold the returned interface name and the
second is the buffer size.
Have a look at ddk\wxp\mmddk.h
--
***@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
Post by jcec
waveInMessage() has two parameters: dwParam1 and dwParam2. I could not get
any documentation that tells their meaning for each case of the parameter
uMsg (in our case DRV_QUERYDEVICEINTERFACE )
Do you know of such a documentation or the values to use for this specific
case ?
Thanks.
Post by Francois PIETTE
Post by jcec
How can I get programatically "sound device names" (XP), "friendly
names" and "descriptions" (Seven) from the "device instance IDs" such as
devcon shows me ?
http://msdn.microsoft.com/en-us/library/ms790392.aspx
You can call waveInGetNumDevs to know how many (count) sound devices the
system has.
The you can loop thru all DevID (from 0 to count-1) and call
waveInGetDevCaps to get the structure containing the product name, and call
waveInMessage passing DRV_QUERYDEVICEINTERFACE to get the interface name
(The interface name comes from the registry).
Similar function with waveOut.
Hope this helps.
--
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
.
Loading...