Share via


MaxPacketSize0 Property

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

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

Property Value

The new value for the maximum packet size.

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 set and get the MaxPacketSize0 property.

HRESULT CLoopBackDevice::UpdateMaxPacketSize0(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
BYTE        bMaxPacketSize0 = 0;
BYTE        bNewMaxPacketSize0 = 64;

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

// Get the current maximum packet size
 hr = piDevice->get_MaxPacketSize0 (&bMaxPacketSize0);
 if(FAILED(hr))
 goto Exit;

// Update the maximum packet size if required
 if (bNewMaxPacketSize0 != bMaxPacketSize0)
{
 hr = piDevice->put_MaxPacketSize0 (bNewMaxPacketSize0);
 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