MaxPacketSize0 Property

The MaxPacketSize0 property gets or sets the bMaxPacketSize0 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_MaxPacketSize0(
  [in]           BYTE bMaxPacket
);

HRESULT get_MaxPacketSize0(
  [out, retval]  BYTE *pbMaxPacket
);

Property Value

The new value for the maximum packet size for endpoint 0.

Error Codes

MaxPacketSize0 returns S_OK if the operation succeeds or E_POINTER if the pbMaxPacket parameter is not a valid pointer.

Remarks

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

HRESULT CLoopBackDevice::SetDeviceQualifierMaxPacketSize0(ISoftUSBDeviceQualifier *piQualifier)
{
HRESULT hr = S_OK;
BYTE         bMaxPacketSize0 = 0;
BYTE         bNewMaxPacketSize0 = 64;

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

// Get the current maximum packet size
hr = piQualifier->get_MaxPacketSize0 (&bMaxPacketSize0);
if(FAILED(hr))
  goto Exit;
 
// Update the maximum packet size if required.
if (bMaxPacketSize0 != bNewMaxPacketSize0)
{
  hr = piQualifier->put_ MaxPacketSize0 (bNewMaxPacketSize0);
  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