DeviceClass Property

The DeviceClass property gets or sets the value of the bDeviceClass field of the device descriptor, as defined in section 9.6.1 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 for 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 set and get the DeviceClass property.

HRESULT CLoopBackDevice::SetDeviceClass(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
BYTE         bDeviceClass= 0;
BYTE         bNewDeviceClass = 0xff; //Vendor specific class 

 if (NULL == piDevice)
{
 hr = E_POINTER;
 goto Exit;
}

 hr = piDevice->get_DeviceClass(&bDeviceClass);
 if(FAILED(hr))
 goto Exit;

 if (bDeviceClass != bNewDeviceClass)
{
 hr = piDevice->put_DeviceClass(bNewDeviceClass);
 if(FAILED(hr))
 goto Exit;
}
Exit:
 return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBDevice

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010