本文整理汇总了C++中HIDDevice::Removed方法的典型用法代码示例。如果您正苦于以下问题:C++ HIDDevice::Removed方法的具体用法?C++ HIDDevice::Removed怎么用?C++ HIDDevice::Removed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HIDDevice
的用法示例。
在下文中一共展示了HIDDevice::Removed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
status_t
usb_hid_device_removed(void *cookie)
{
mutex_lock(&sDriverLock);
int32 parentCookie = (int32)cookie;
TRACE("device_removed(%ld)\n", parentCookie);
for (int32 i = 0; i < gDeviceList->CountDevices(); i++) {
ProtocolHandler *handler = (ProtocolHandler *)gDeviceList->DeviceAt(i);
if (!handler)
continue;
HIDDevice *device = handler->Device();
if (device->ParentCookie() != parentCookie)
continue;
// this handler's device belongs to the one removed
if (device->IsOpen()) {
// the device and it's handlers will be deleted in the free hook
device->Removed();
break;
}
// remove all the handlers
for (uint32 i = 0;; i++) {
handler = device->ProtocolHandlerAt(i);
if (handler == NULL)
break;
gDeviceList->RemoveDevice(NULL, handler);
}
delete device;
break;
}
mutex_unlock(&sDriverLock);
return B_OK;
}