boolean CUSBHIDDevice::Configure (unsigned nMaxReportSize) { if (GetNumEndpoints () < 1) { ConfigurationError (FromUSBHID); return FALSE; } const TUSBEndpointDescriptor *pEndpointDesc; while ((pEndpointDesc = (TUSBEndpointDescriptor *) GetDescriptor (DESCRIPTOR_ENDPOINT)) != 0) { if ((pEndpointDesc->bmAttributes & 0x3F) == 0x03) // Interrupt EP { if ((pEndpointDesc->bEndpointAddress & 0x80) == 0x80) // Input EP { if (m_pReportEndpoint != 0) { ConfigurationError (FromUSBHID); return FALSE; } m_pReportEndpoint = new CUSBEndpoint (GetDevice (), pEndpointDesc); } else // Output EP { if (m_pEndpointOut != 0) { ConfigurationError (FromUSBHID); return FALSE; } m_pEndpointOut = new CUSBEndpoint (GetDevice (), pEndpointDesc); } } } if (m_pReportEndpoint == 0) { ConfigurationError (FromUSBHID); return FALSE; } if (!CUSBFunction::Configure ()) { CLogger::Get ()->Write (FromUSBHID, LogError, "Cannot set interface"); return FALSE; } if ( GetInterfaceClass () == 3 // HID class && GetInterfaceSubClass () == 1) // boot class { if (GetHost ()->ControlMessage (GetEndpoint0 (), REQUEST_OUT | REQUEST_CLASS | REQUEST_TO_INTERFACE, SET_PROTOCOL, BOOT_PROTOCOL, GetInterfaceNumber (), 0, 0) < 0) { CLogger::Get ()->Write (FromUSBHID, LogError, "Cannot set boot protocol"); return FALSE; } } if (m_nMaxReportSize == 0) { m_nMaxReportSize = nMaxReportSize; assert (m_nMaxReportSize > 0); assert (m_pReportBuffer == 0); m_pReportBuffer = new u8[m_nMaxReportSize]; } assert (m_pReportBuffer != 0); return TRUE; }
//--------------------------------------------------------------------------- UEProperty::Info UEInterfaceProperty::GetInfo() const { return Info::Create(PropertyType::PredefinedStruct, sizeof(FScriptInterface), true, "TScriptInterface<class " + MakeValidName(GetInterfaceClass().GetNameCPP()) + ">"); }