本文整理汇总了C++中DevicePtr::SetActiveConfigValue方法的典型用法代码示例。如果您正苦于以下问题:C++ DevicePtr::SetActiveConfigValue方法的具体用法?C++ DevicePtr::SetActiveConfigValue怎么用?C++ DevicePtr::SetActiveConfigValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevicePtr
的用法示例。
在下文中一共展示了DevicePtr::SetActiveConfigValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetActiveConfigValue
BOOL OpenContext::SetActiveConfigValue(LPUKWD_SET_ACTIVE_CONFIG_VALUE_INFO lpConfigValueInfo)
{
MutexLocker lock(mMutex);
DevicePtr dev (mDevice->GetDeviceList(), lpConfigValueInfo->lpDevice);
if (!Validate(dev)) {
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (dev->AnyInterfacesClaimed()) {
ERROR_MSG((TEXT("USBKWrapperDrv!OpenContext::SetActiveConfigValue() - ")
TEXT("attempting to set configuration on device 0x%08x with claimed interfaces\r\n"),
lpConfigValueInfo->lpDevice));
SetLastError(ERROR_BUSY);
return FALSE;
}
/* WARNING: THIS IS NOT SUPPORTED PROPERLY YET!!
* The driver has a prototype implementation for IOCTL_UKW_SET_ACTIVE_CONFIG_VALUE,
* which manually sends the SET_CONFIGURATION control transfer. This, however, then
* causes WinCE to become out-of-sync with the actual device configuration (most likely
* leading to all sorts of fun and games!). Currently, the driver therefore only send
* the control transfer if the requested configuration is already active.
*/
UCHAR cv = 0;
GetActiveConfigValue(lpConfigValueInfo->lpDevice, &cv);
if (cv != lpConfigValueInfo->value) {
SetLastError(ERROR_NOT_SUPPORTED);
return FALSE;
}
return dev->SetActiveConfigValue(lpConfigValueInfo->value);
}