Share via


Product Property

The Product property gets or sets the value of the idProduct 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_Product(
  [in]           SHORT sProduct
);

HRESULT get_Product(
  [out, retval]  SHORT *psProduct
);

Property Value

The new value for the product ID.

Error Codes

Product returns S_OK if the operation succeeds or E_POINTER if the psProduct parameter is not a valid pointer.

Remarks

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

HRESULT CLoopBackDevice::UpdateProductId(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
SHORT     sProductId = 0;
USHORT    usNewProductId = 0x930a; //BULK USB product ID

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

// Get the current product ID
 hr = piDevice->get_Product (&sProductId);
 if(FAILED(hr))
 goto Exit;

// Update the product ID if required
 if (sNewProductId != sProductId)
{
 hr = piDevice->put_Product (sNewProductId);
 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