DeviceProtocol Property

The DeviceProtocol property gets or sets the bDeviceProtocol 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_DeviceProtocol(
  [in]           BYTE bProtocol
);

HRESULT get_DeviceProtocol(
  [out, retval]  BYTE *pbProtocol
);

Property Value

The new value for the device protocol.

Error Codes

DeviceProtocol returns S_OK if the operation succeeds or E_POINTER if the pbProtocol parameter is not a valid pointer.

Remarks

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

HRESULT CLoopBackDevice::SetDeviceQualifierDeviceProtocol(ISoftUSBDeviceQualifier *piQualifier)
{
HRESULT hr = S_OK;
BYTE         bDeviceProtocol = 0;
BYTE         bNewDeviceProtocol = 0xff; //Vendor specific

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

// Get the current device protocol
hr = piQualifier->get_DeviceProtocol(&bDeviceProtocol);
if(FAILED(hr))
  goto Exit;
 
// Update the device protocol if needed.
if (bDeviceProtocol != bNewDeviceProtocol)
{
  hr = piQualifier->put_DeviceProtocol(bNewDeviceProtocol);
  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