From: RJ on 1 Sep 2008 13:01 With C# - VS2008 Pro - Trying to access access USB Audio Device (Alesis Midi Trigger I/O) for read only purposes... XP SP2 Device Manager shows device under "Sound, video and game controllers" as "USB Audio Device" working properly. I'm not finding this device when calling SetupDiGetClassDevs & SetupDiEnumDeviceInterfaces. I tried to pass null for ClassGuid param of SetupDiGetClassDevs as Windows Driver Kit docs suggest. Also tried Windows Driver Kit doc example - SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT). Also tried an unconfirmed ClassGuid value I found defined on web as USB Raw Device class guid {a5dcbf10-6530-11d2-901f-00c04fb951ed} No success on any attempt. No errors. No devices returned on subsequent SetupDiEnumDeviceInterfaces call. Is there another way I can access this device, for read only purposes, using the Device Instance ID listed by Device Manager? As a sanity check, I was able to use the guid returned by HidD_GetHidGuid of hid.dll.... SetupDiGetClassDevs & SetupDiEnumDeviceInterfaces seems to successfully return info on usb HID devices only. I don't think Sound, video and game controllers are HID. Any input is greatly appreciated.
From: David Miller on 2 Sep 2008 01:18 Why don't you use the MMSystem API or the DirectMusic API? That would be much easier that the Setup API. If you really want the Setup API then here's how to do it: 1) Call SetupDiGetClassDevs with KSCATEGORY_AUDIO. 2) Call SetupDiEnumDeviceInterfaces to get the SP_DEVINFO_DATA for the next device in HDEVINFO list. 3) Call SetupDiGetDeviceInterfaceAlias with KSCATEGORY_CAPTURE. 5) Call SetupDiGetDeviceInterfaceDetail to get the device path. 6) Look for the Alesis USB vendor ID sub-string (Vid_xxxx) in the device path. 7) Look for the Trigger I/O product ID sub-string (Pid_xxxx) in the device path. 8) Call CreateFile on the device path to instantiate the filter. 9) Call KsCreatePin on the filter handle to instantiate the pin. You are lucky because the Trigger I/O probably only has one capture pin. The rest is up to you. :) You can also find the device path using the routines in the MMSystem API. 1) Call midiInGetNumDevs to count the midi capture devices. 2) Call midiInMessage with DRV_QUERYDEVICEINTERFACE to get the device path. 3) Follows steps 6 - 9 described above. And if you really feel the urge to go where no man has gone before then you can wrap a midi device with the KS proxy using OLE: CoGetObject(pwszDevicePath, NULL, IID_IBaseFilter, (pvoid)&pBaseFilter). "RJ" wrote: > With C# - VS2008 Pro - Trying to access access USB Audio Device (Alesis Midi > Trigger I/O) for read only purposes... > XP SP2 Device Manager shows device under "Sound, video and game controllers" > as "USB Audio Device" working properly. > > I'm not finding this device when calling SetupDiGetClassDevs & > SetupDiEnumDeviceInterfaces. > I tried to pass null for ClassGuid param of SetupDiGetClassDevs as Windows > Driver Kit docs suggest. > Also tried Windows Driver Kit doc example - SetupDiGetClassDevs(NULL, NULL, > NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT). > Also tried an unconfirmed ClassGuid value I found defined on web as USB Raw > Device class guid {a5dcbf10-6530-11d2-901f-00c04fb951ed} > No success on any attempt. No errors. > No devices returned on subsequent SetupDiEnumDeviceInterfaces call. > > Is there another way I can access this device, for read only purposes, using > the Device Instance ID listed by Device Manager? > > As a sanity check, I was able to use the guid returned by HidD_GetHidGuid of > hid.dll.... SetupDiGetClassDevs & SetupDiEnumDeviceInterfaces seems to > successfully return info on usb HID devices only. I don't think Sound, > video and game controllers are HID. > > Any input is greatly appreciated. >
|
Pages: 1 Prev: What's different from XP and Vista System flow? Next: BSOD with DC2 |