DeviceClass Property

The DeviceClass property gets or sets the bDeviceClass field of the device qualifier descriptor, as described in section 9.6.2 of the USB 2.0 specification.

This property is read/write.

Syntax

HRESULT put_DeviceClass(
  [in]           BYTE bDeviceClass
);

HRESULT get_DeviceClass(
  [out, retval]  BYTE *pbDeviceClass
);

Property Value

The new value of the device class.

Error Codes

DeviceClass returns S_OK if the operation succeeds or E_POINTER if the pbDeviceClass parameter is not a valid pointer.

Remarks

The following C++ code example shows how to get and set DeviceClass property.

HRESULT CLoopBackDevice::SetDeviceQualifierDeviceClass(ISoftUSBDeviceQualifier *piQualifier)
{
HRESULT hr = S_OK;
BYTE         bDeviceClass = 0;
BYTE         bNewDeviceClass = 0xff; //Vendor specific

if (NULL == piQualifier)
{
  hr = E_INVALIDARG;
  goto Exit;
}

// Get the current device class
hr = piQualifier->get_DeviceClass(&bDeviceClass);
if(FAILED(hr))
  goto Exit;
 
// Update the device class if necessary
if (bDeviceClass != bNewDeviceClass)
{
  hr = piQualifier->put_DeviceClass(bNewDeviceClass);
  if(FAILED(hr))
    goto Exit;
}
Exit:
return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBDeviceQualifier

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010