Share via


MaxPacketSize Property

The MaxPacketSize property gets or sets the wMaxPacketSize field of the endpoint descriptor, as described in section 9.6.6 of the USB 2.0 specification.

This property is read/write.

Syntax

HRESULT put_MaxPacketSize(
  [in]           SHORT sMaxPacketSize
);

HRESULT get_MaxPacketSize(
  [out, retval]  SHORT *psMaxPacket
);

Property Value

The new maximum packet size for the endpoint.

Error Codes

MaxPacketSize returns S_OK if the operation succeeds or E_POINTER if the psMaxPacket parameter is not a valid pointer.

Remarks

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

HRESULT CLoopBackDevice::UpdateEndpointMaxPacketSize(ISoftUSBEndpoint *piEndpoint)
{
HRESULT hr = S_OK;
SHORT sMaxPacketSize = 0;
SHORT sNewMaxPacketSize = 1024;

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

// Get the current MaxPacketSize property
 hr = piEndpoint->get_MaxPacketSize (&sMaxPacketSize);
 if(FAILED(hr))
 goto Exit;

// Update the MaxPacketSize if required
 if (sNewMaxPacketSize != sMaxPacketSize)
{
 hr = piEndpoint->put_MaxPacketSize(sNewMaxPacketSize);
 if(FAILED(hr))
 goto Exit;
}
Exit:
 return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBEndpoint

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010