Share via


DeviceProtocol Property

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

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

Property Value

The new 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 set and get the DeviceProtocol property.

HRESULT CLoopBackDevice::SetDeviceProtocol(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
BYTE         bDeviceProtocol= 0;
BYTE         bNewDeviceProtocol = 0xff; // Vendor-specific protocol 

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

 hr = piDevice->get_DeviceProtocol (&bDeviceProtocol);
 if(FAILED(hr))
 goto Exit;

 if (bDeviceProtocol != bNewDeviceProtocol)
{
 hr = piDevice->put_DeviceProtocol (bNewDeviceProtocol);
 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