这篇教程C++ ERROR_LOG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ERROR_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ ERROR_LOG函数的具体用法?C++ ERROR_LOG怎么用?C++ ERROR_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ERROR_LOG函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ERROR_LOGbool VirtualDiscFileSystem::RmDir(const std::string &dirname){ ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove directory on virtual disc"); return false;}
开发者ID:Bigpet,项目名称:ppsspp,代码行数:5,
示例2: ERROR_LOG/*---------------------------------------------------------------------------*/struct xio_server *xio_bind(struct xio_context *ctx, struct xio_session_ops *ops, const char *uri, uint16_t *src_port, uint32_t session_flags, void *cb_private_data){ struct xio_server *server; int retval; int backlog = 4; if (!ctx || !ops || !uri) { ERROR_LOG("invalid parameters ctx:%p, ops:%p, uri:%p/n", ctx, ops, uri); xio_set_error(EINVAL); return NULL; } TRACE_LOG("bind to %s/n", uri); /* create the server */ server = (struct xio_server *) kcalloc(1, sizeof(struct xio_server), GFP_KERNEL); if (!server) { xio_set_error(ENOMEM); return NULL; } kref_init(&server->kref); /* fill server data*/ server->ctx = ctx; server->cb_private_data = cb_private_data; server->uri = kstrdup(uri, GFP_KERNEL); server->session_flags = session_flags; memcpy(&server->ops, ops, sizeof(*ops)); XIO_OBSERVER_INIT(&server->observer, server, xio_on_nexus_event); XIO_OBSERVABLE_INIT(&server->nexus_observable, server); server->listener = xio_nexus_open(ctx, uri, NULL, 0, 0, NULL); if (!server->listener) { ERROR_LOG("failed to create connection/n"); goto cleanup; } retval = xio_nexus_listen(server->listener, uri, src_port, backlog); if (retval != 0) { ERROR_LOG("connection listen failed/n"); goto cleanup1; } xio_nexus_set_server(server->listener, server); xio_idr_add_uobj(usr_idr, server, "xio_server"); return server;cleanup1: xio_nexus_close(server->listener, NULL);cleanup: kfree(server->uri); kfree(server); return NULL;}
开发者ID:caomw,项目名称:accelio,代码行数:66,
示例3: __KernelReceiveMsgPipestatic int __KernelReceiveMsgPipe(MsgPipe *m, u32 receiveBufAddr, u32 receiveSize, int waitMode, u32 resultAddr, u32 timeoutPtr, bool cbEnabled, bool poll, bool &needsResched, bool &needsWait){ u32 curReceiveAddr = receiveBufAddr; SceUID uid = m->GetUID(); // MsgPipe buffer size is 0, receiving directly from waiting send threads if (m->nmp.bufSize == 0) { m->SortSendThreads(); // While they're still sending waiting threads (which can send data) while (!m->sendWaitingThreads.empty() && receiveSize != 0) { MsgPipeWaitingThread *thread = &m->sendWaitingThreads.front(); // For send threads, "freeSize" is "free to be read". u32 bytesToReceive = std::min(thread->freeSize, receiveSize); if (bytesToReceive > 0) { thread->ReadBuffer(curReceiveAddr, bytesToReceive); receiveSize -= bytesToReceive; curReceiveAddr += bytesToReceive; if (thread->freeSize == 0 || thread->waitMode == SCE_KERNEL_MPW_ASAP) { thread->Complete(uid, 0); m->sendWaitingThreads.erase(m->sendWaitingThreads.begin()); needsResched = true; thread = NULL; } } } // All data hasn't been received and (mode isn't ASAP or nothing was received) if (receiveSize != 0 && (waitMode != SCE_KERNEL_MPW_ASAP || curReceiveAddr == receiveBufAddr)) { if (poll) { // Generally, result is not updated in this case. But for a 0 size buffer in ASAP mode, it is. if (Memory::IsValidAddress(resultAddr) && waitMode == SCE_KERNEL_MPW_ASAP) Memory::Write_U32(curReceiveAddr - receiveBufAddr, resultAddr); return SCE_KERNEL_ERROR_MPP_EMPTY; } else { m->AddReceiveWaitingThread(__KernelGetCurThread(), curReceiveAddr, receiveSize, waitMode, resultAddr); needsWait = true; return 0; } } } // Getting data from the MsgPipe buffer else { if (receiveSize > (u32) m->nmp.bufSize) { ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): size %d too large for buffer", uid, receiveSize); return SCE_KERNEL_ERROR_ILLEGAL_SIZE; } while (m->GetUsedSize() > 0) { u32 bytesToReceive = std::min(receiveSize, m->GetUsedSize()); if (bytesToReceive != 0) { Memory::Memcpy(curReceiveAddr, m->buffer, bytesToReceive); m->nmp.freeSize += bytesToReceive; memmove(Memory::GetPointer(m->buffer), Memory::GetPointer(m->buffer) + bytesToReceive, m->GetUsedSize()); curReceiveAddr += bytesToReceive; receiveSize -= bytesToReceive; m->CheckSendThreads(); } else break; } if (receiveSize != 0 && (waitMode != SCE_KERNEL_MPW_ASAP || curReceiveAddr == receiveBufAddr)) { if (poll) return SCE_KERNEL_ERROR_MPP_EMPTY; else { m->AddReceiveWaitingThread(__KernelGetCurThread(), curReceiveAddr, receiveSize, waitMode, resultAddr); needsWait = true; return 0; } } } if (Memory::IsValidAddress(resultAddr)) Memory::Write_U32(curReceiveAddr - receiveBufAddr, resultAddr); return 0;}
开发者ID:libretro,项目名称:PSP1,代码行数:95,
示例4: create_lost_reqint create_lost_req(xmlNode* location, char* service, loc_fmt d_loc_fmt, str* lost_req){ xmlDocPtr doc= NULL; xmlNodePtr root_node; xmlNodePtr loc_node = NULL, loc_copy=NULL; char * id = "1234"; char * profile; xmlChar * req_body = NULL; int req_len = 0; if(d_loc_fmt == ERR_LOC){ ERROR_LOG("cannot use location with errornous format/n"); goto error; } profile = map_profile[d_loc_fmt]; /* creating the xml doc for the LoST message*/ doc= xmlNewDoc(BAD_CAST "1.0"); if(doc== NULL){ ERROR_LOG("when creating new xml doc/n"); goto error; } root_node = xmlNewNode(NULL, BAD_CAST LOST_FIND_SERVICE_CMD); if(root_node==0){ ERROR_LOG("when adding new node %s/n", LOST_FIND_SERVICE_CMD); goto error; } xmlDocSetRootElement(doc, root_node); if(!xmlNewNs(root_node, BAD_CAST LOST_NS_HREF, NULL)){ ERROR_LOG("could not add the namespace %s to the root node/n", LOST_NS_HREF); goto error; } loc_node = xmlNewNode(NULL, BAD_CAST LOST_LOCATION_NODE); if(!loc_node){ ERROR_LOG("when creating new node %s/n", LOST_LOCATION_NODE); goto error; } if(!xmlNewProp(loc_node, BAD_CAST LOST_ID_PROP , BAD_CAST id)){ ERROR_LOG("could not add the property %s/n", LOST_ID_PROP); goto error; } if(!xmlNewProp(loc_node, BAD_CAST LOST_PROFILE_PROP , BAD_CAST profile)){ ERROR_LOG("could not add the property %s/n", LOST_ID_PROP); goto error; } //do a recursive copy of the location information loc_copy = xmlCopyNode(location, 1); if(!loc_copy){ ERROR_LOG("could not duplicate the location information node/n"); goto error; } if(!xmlAddChild(loc_node, loc_copy)){ ERROR_LOG("could not add the location information to the location node/n"); goto error; } loc_copy = NULL; if(!xmlAddChild(root_node, loc_node)){ ERROR_LOG("could not add the %s node to root/n", LOST_LOCATION_NODE); goto error; } loc_node = NULL; if(!xmlNewChild(root_node, NULL, BAD_CAST LOST_SERVICE_NODE, BAD_CAST service)){ ERROR_LOG("could not add the %s node to root/n", LOST_SERVICE_NODE); goto error; } //print_element_names(root_node); xmlDocDumpFormatMemoryEnc(doc, &req_body, &req_len, LOST_XML_ENC, 1); lost_req->s = (char*) req_body; lost_req->len = req_len; if(!lost_req->s || !lost_req->len){ ERROR_LOG("could not output the xml document/n"); goto error; } //DEBUG_LOG("lost request: %.*s/n", lost_req->len, lost_req->s); xmlFreeDoc(doc); return 0;error: if(loc_node) xmlFreeNode(loc_node); if(loc_copy) xmlFreeNode(loc_copy);//.........这里部分代码省略.........
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:101,
示例5: get_mapped_psap/* Get the value of the returned psap URI from a LoST response * @param root - the root of an parsed xml LoST response other than error or redirect * @param exp_type - used to get the type of mapping: no-cache, no-expiration or with an expiration date * @param exp_timestamp- used to get the timestamp of when the mapping will expire * @param parsed_uri- used to get the parsed uri * @returns the name of the psap uri in shm memory */str get_mapped_psap(xmlNode* root, expire_type * exp_type, time_t* exp_timestamp, struct sip_uri* parsed_uri){ xmlNode * mapping, *uri; xmlAttr * expires_attr; xmlChar* content; str uri_str, shm_uri={NULL, 0}; char * expires_str; if(!(mapping = child_named_node(root, LOST_MAPPING_NODE_NAME))){ ERROR_LOG("Could not find a mapping element in the LoST response/n"); return shm_uri; } if(!(uri = child_named_node(mapping, LOST_URI_NODE_NAME))){ ERROR_LOG("Could not find any uri child on the mapping element in the LoST response/n"); return shm_uri; }get_uri: content = xmlNodeGetContent((xmlNodePtr)uri); uri_str.s = (char*)content; if(!uri_str.s || (uri_str.s[0] == '/0')){ ERROR_LOG("Could not get the content of the uri element/n"); return shm_uri; } uri_str.len = strlen(uri_str.s); DEBUG_LOG("Found a uri: %.*s/n", uri_str.len, uri_str.s); //check if the uri is a well formed sip uri if((parse_uri(uri_str.s, uri_str.len, parsed_uri)<0) || ((parsed_uri->type != SIP_URI_T) && (parsed_uri->type != SIPS_URI_T))){ ERROR_LOG("the URI %.*s is no SIP/SIPS URI, for the moment only SIP/SIPS URIs are supported/n", uri_str.len, uri_str.s); if(!(uri = sibling_named_node(uri, LOST_URI_NODE_NAME))){ ERROR_LOG("Could not find any other uri child on the mapping element in the LoST response/n"); return shm_uri; } goto get_uri; } if(!(expires_attr = get_attr(mapping, LOST_EXPIRES_ATTR_NAME))){ ERROR_LOG("Could not find an expires attr of mapping element in the LoST response/n"); return shm_uri; } expires_str = (char*)expires_attr->children->content; if(!expires_str || !strlen(expires_str)){ ERROR_LOG("Expires attribute with null content/n"); return shm_uri; } DEBUG_LOG("expires is %s/n", expires_str); //get expiration time ISO 8601 if(get_time(expires_str, exp_type, exp_timestamp)){ ERROR_LOG("Invalid value for the attribute expires %s/n", expires_str); return shm_uri; } //copy in shm memory shm_uri.s = (char*)cds_malloc(uri_str.len*sizeof(char)); if(!shm_uri.s){ ERROR_LOG("Out of shm memory/n"); }else{ memcpy(shm_uri.s, uri_str.s, uri_str.len*sizeof(char)); shm_uri.len = uri_str.len; } xmlFree(content); return shm_uri;}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:83,
示例6: ERROR_LOG void StateManager::Apply() { if (!m_blendStates.empty()) { if (m_currentBlendState != m_blendStates.top().get()) { m_currentBlendState = (ID3D11BlendState*)m_blendStates.top().get(); D3D::context->OMSetBlendState(m_currentBlendState, nullptr, 0xFFFFFFFF); } } else ERROR_LOG(VIDEO, "Tried to apply without blend state!"); if (!m_depthStates.empty()) { if (m_currentDepthState != m_depthStates.top().get()) { m_currentDepthState = (ID3D11DepthStencilState*)m_depthStates.top().get(); D3D::context->OMSetDepthStencilState(m_currentDepthState, 0); } } else ERROR_LOG(VIDEO, "Tried to apply without depth state!"); if (!m_rasterizerStates.empty()) { if (m_currentRasterizerState != m_rasterizerStates.top().get()) { m_currentRasterizerState = (ID3D11RasterizerState*)m_rasterizerStates.top().get(); D3D::context->RSSetState(m_currentRasterizerState); } } else ERROR_LOG(VIDEO, "Tried to apply without rasterizer state!"); if (!m_dirtyFlags) { return; } if (m_dirtyFlags & DirtyFlag_Constants) { if (use_partial_buffer_update) { if (m_dirtyFlags & DirtyFlag_PixelConstants) { if (m_pending.pixelConstantsSize[0] == 0 && m_pending.pixelConstantsSize[1] == 0) { D3D::context->PSSetConstantBuffers(0, m_pending.pixelConstants[1] ? 2 : 1, m_pending.pixelConstants); } else { D3D::context1->PSSetConstantBuffers1(0, m_pending.pixelConstants[1] ? 2 : 1, m_pending.pixelConstants, m_pending.pixelConstantsOffset, m_pending.pixelConstantsSize); } m_current.pixelConstants[0] = m_pending.pixelConstants[0]; m_current.pixelConstantsOffset[0] = m_pending.pixelConstantsOffset[0]; m_current.pixelConstantsSize[0] = m_pending.pixelConstantsSize[0]; m_current.pixelConstants[1] = m_pending.pixelConstants[1]; m_current.pixelConstantsOffset[1] = m_pending.pixelConstantsOffset[1]; m_current.pixelConstantsSize[1] = m_pending.pixelConstantsSize[1]; } if (m_dirtyFlags & DirtyFlag_VertexConstants) { if (m_pending.vertexConstantsSize == 0) { D3D::context->VSSetConstantBuffers(0, 1, &m_pending.vertexConstants); } else { D3D::context1->VSSetConstantBuffers1(0, 1, &m_pending.vertexConstants, &m_pending.vertexConstantsOffset, &m_pending.vertexConstantsSize); } m_current.vertexConstants = m_pending.vertexConstants; m_current.vertexConstantsOffset = m_pending.vertexConstantsOffset; m_current.vertexConstantsSize = m_pending.vertexConstantsSize; } if (m_dirtyFlags & DirtyFlag_GeometryConstants) { if (m_pending.geometryConstantsSize == 0) { D3D::context->GSSetConstantBuffers(0, 1, &m_pending.geometryConstants); } else { D3D::context1->GSSetConstantBuffers1(0, 1, &m_pending.geometryConstants, &m_pending.geometryConstantsOffset, &m_pending.geometryConstantsSize); } m_current.geometryConstants = m_pending.geometryConstants; m_current.geometryConstantsOffset = m_pending.geometryConstantsOffset; m_current.geometryConstantsSize = m_pending.geometryConstantsSize; } if (m_dirtyFlags & DirtyFlag_HullDomainConstants) { if (g_ActiveConfig.backend_info.bSupportsTessellation) { if (m_pending.hulldomainConstantsSize == 0) { D3D::context->HSSetConstantBuffers(0, 3, m_pending.hulldomainConstants); D3D::context->DSSetConstantBuffers(0, 3, m_pending.hulldomainConstants); } else { D3D::context1->HSSetConstantBuffers1(0, 3, m_pending.hulldomainConstants, m_pending.hulldomainConstantsOffset, m_pending.hulldomainConstantsSize); D3D::context1->DSSetConstantBuffers1(0, 3, m_pending.hulldomainConstants, m_pending.hulldomainConstantsOffset, m_pending.hulldomainConstantsSize); }//.........这里部分代码省略.........
开发者ID:gamax92,项目名称:Ishiiruka,代码行数:101,
示例7: ixEthDBNPEUpdateHandler/** * @brief standard NPE update handler * * @param portID id of the port to be updated * @param type record type to be pushed during this update * * The NPE update handler manages updating the NPE databases * given a certain record type. * * @internal */IX_ETH_DB_PUBLICIxEthDBStatus ixEthDBNPEUpdateHandler(IxEthDBPortId portID, IxEthDBRecordType type){ UINT32 epDelta, blockCount; IxNpeMhMessage message; UINT32 treeSize = 0; PortInfo *port = &ixEthDBPortInfo[portID]; /* size selection and type check */ if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD) { treeSize = FULL_ELT_BYTE_SIZE; } else if (type == IX_ETH_DB_FIREWALL_RECORD) { treeSize = FULL_FW_BYTE_SIZE; } else if (type == IX_ETH_DB_MASKED_FIREWALL_RECORD) { treeSize = FULL_FW_M_BYTE_SIZE; } else { return IX_ETH_DB_INVALID_ARG; } /* serialize tree into memory */ ixEthDBNPETreeWrite(type, treeSize, port->updateMethod.npeUpdateZone, port->updateMethod.searchTree, &epDelta, &blockCount); /* free internal copy */ if (port->updateMethod.searchTree != NULL) { ixEthDBFreeMacTreeNode(port->updateMethod.searchTree); } /* forget last used search tree */ port->updateMethod.searchTree = NULL; port->updateMethod.searchTreePendingWrite = FALSE; /* dependending on the update type we do different things */ if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD) { IX_STATUS result; FILL_SETMACADDRESSDATABASE_MSG(message, IX_ETHNPE_PHYSICAL_ID_TO_NODE_LOGICAL_ID(portID), epDelta, blockCount, IX_OSAL_MMU_VIRT_TO_PHYS(port->updateMethod.npeUpdateZone)); IX_ETHDB_SEND_NPE_MSG(IX_ETHNPE_PHYSICAL_ID_TO_NODE(portID), message, result); if (result == IX_SUCCESS) { IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) Finished downloading NPE tree on port %d/n", portID); } else { ixEthDBPortInfo[portID].agingEnabled = FALSE; ixEthDBPortInfo[portID].updateMethod.updateEnabled = FALSE; ixEthDBPortInfo[portID].updateMethod.userControlled = TRUE; ERROR_LOG("EthDB: (PortUpdate) disabling aging and updates on port %d (assumed dead)/n", portID); ixEthDBDatabaseClear(portID, IX_ETH_DB_ALL_RECORD_TYPES); return IX_ETH_DB_FAIL; } return IX_ETH_DB_SUCCESS; } else if (type & IX_ETH_DB_FIREWALL_RECORD) { return ixEthDBFirewallUpdate(portID, port->updateMethod.npeUpdateZone, epDelta); } return IX_ETH_DB_INVALID_ARG;}
开发者ID:dafyddcrosby,项目名称:L4OS,代码行数:87,
示例8: ERROR_LOGvoid ISOFileSystem::ReadDirectory(u32 startsector, u32 dirsize, TreeEntry *root, size_t level){ for (u32 secnum = startsector, endsector = dirsize/2048 + startsector; secnum < endsector; ++secnum) { u8 theSector[2048]; blockDevice->ReadBlock(secnum, theSector); for (int offset = 0; offset < 2048; ) { DirectoryEntry &dir = *(DirectoryEntry *)&theSector[offset]; u8 sz = theSector[offset]; // Nothing left in this sector. There might be more in the next one. if (sz == 0) break; const int IDENTIFIER_OFFSET = 33; if (offset + IDENTIFIER_OFFSET + dir.identifierLength > 2048) { ERROR_LOG(FILESYS, "Directory entry crosses sectors, corrupt iso?"); return; } offset += dir.size; bool isFile = (dir.flags & 2) ? false : true; bool relative; TreeEntry *e = new TreeEntry(); if (dir.identifierLength == 1 && (dir.firstIdChar == '/x00' || dir.firstIdChar == '.')) { e->name = "."; relative = true; } else if (dir.identifierLength == 1 && dir.firstIdChar == '/x01') { e->name = ".."; relative = true; } else { e->name = std::string((char *)&dir.firstIdChar, dir.identifierLength); relative = false; } e->size = dir.dataLength(); e->startingPosition = dir.firstDataSector() * 2048; e->isDirectory = !isFile; e->flags = dir.flags; e->parent = root; // Let's not excessively spam the log - I commented this line out. //DEBUG_LOG(FILESYS, "%s: %s %08x %08x %i", e->isDirectory?"D":"F", e->name.c_str(), dir.firstDataSectorLE, e->startingPosition, e->startingPosition); if (e->isDirectory && !relative) { if (dir.firstDataSector() == startsector) { ERROR_LOG(FILESYS, "WARNING: Appear to have a recursive file system, breaking recursion"); } else { bool doRecurse = true; if (!restrictTree.empty()) doRecurse = level < restrictTree.size() && restrictTree[level] == e->name; if (doRecurse) ReadDirectory(dir.firstDataSector(), dir.dataLength(), e, level + 1); else continue; } } root->children.push_back(e); } }}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:76,
示例9: whileISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(std::string path, bool catchError){ if (path.length() == 0) { //Ah, the device! "umd0:" return &entireISO; } if (path.substr(0,2) == "./") path.erase(0,2); if (path[0] == '/') path.erase(0,1); if (path == "umd0") return &entireISO; TreeEntry *e = treeroot; if (path.length() == 0) return e; while (true) { TreeEntry *ne = 0; std::string name = ""; if (path.length()>0) { for (size_t i=0; i<e->children.size(); i++) { std::string n = (e->children[i]->name); for (size_t j = 0; j < n.size(); j++) { n[j] = tolower(n[j]); } std::string curPath = path.substr(0, path.find_first_of('/')); for (size_t j = 0; j < curPath.size(); j++) { curPath[j] = tolower(curPath[j]); } if (curPath == n) { //yay we got it ne = e->children[i]; name = n; break; } } } if (ne) { e = ne; size_t l = name.length(); path.erase(0, l); if (path.length() == 0 || (path.length()==1 && path[0] == '/')) return e; path.erase(0, 1); while (path[0] == '/') path.erase(0, 1); } else { if (catchError) { ERROR_LOG(FILESYS,"File %s not found", path.c_str()); } return 0; } }}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:68,
示例10: lk//.........这里部分代码省略......... // The new way to initialize the extension is by writing 0x55 to 0x(4)A400F0, then writing 0x00 to 0x(4)A400FB // 52 16 04 A4 00 F0 01 55 // 52 16 04 A4 00 FB 01 00 u8 const disable_enc_pt1_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55}; u8 const disable_enc_pt2_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00}; CheckDeviceType_Write(dev_handle, disable_enc_pt1_report, sizeof(disable_enc_pt1_report), 1); CheckDeviceType_Write(dev_handle, disable_enc_pt2_report, sizeof(disable_enc_pt2_report), 1); int rc = CheckDeviceType_Write(dev_handle, req_status_report, sizeof(req_status_report), 1); while (rc > 0 && --max_cycles > 0) { if ((rc = CheckDeviceType_Read(dev_handle, buf, 1)) <= 0) { // DEBUG_LOG(WIIMOTE, "CheckDeviceType: Read failed..."); break; } switch (buf[1]) { case WM_STATUS_REPORT: { real_wiimote = true; // DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Status Report"); wm_status_report * wsr = (wm_status_report*)&buf[2]; if (wsr->extension) { // Wiimote with extension, we ask it what kind. u8 read_ext[MAX_PAYLOAD] = {0}; read_ext[0] = WM_SET_REPORT | WM_BT_OUTPUT; read_ext[1] = WM_READ_DATA; // Extension type register. *(u32*)&read_ext[2] = Common::swap32(0x4a400fa); // Size. *(u16*)&read_ext[6] = Common::swap16(6); rc = CheckDeviceType_Write(dev_handle, read_ext, 8, 1); } else { // Normal Wiimote, exit while and be happy. rc = -1; } break; } case WM_ACK_DATA: { real_wiimote = true; //wm_acknowledge * wm = (wm_acknowledge*)&buf[2]; //DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Ack Error: %X ReportID: %X", wm->errorID, wm->reportID); break; } case WM_READ_DATA_REPLY: { // DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Data Reply"); wm_read_data_reply * wrdr = (wm_read_data_reply*)&buf[2]; // Check if it has returned what we asked. if (Common::swap16(wrdr->address) == 0x00fa) { real_wiimote = true; // 0x020420A40000ULL means balance board. u64 ext_type = (*(u64*)&wrdr->data[0]); // DEBUG_LOG(WIIMOTE, // "CheckDeviceType: GOT EXT TYPE %llX", // ext_type); is_bb = (ext_type == 0x020420A40000ULL); } else { ERROR_LOG(WIIMOTE, "CheckDeviceType: GOT UNREQUESTED ADDRESS %X", Common::swap16(wrdr->address)); } // force end rc = -1; break; } default: { // We let read try again incase there is another packet waiting. // DEBUG_LOG(WIIMOTE, "CheckDeviceType: GOT UNKNOWN REPLY: %X", buf[1]); break; } } } } CloseHandle(dev_handle);}
开发者ID:Buddybenj,项目名称:dolphin,代码行数:101,
示例11: mainint main(int argc, char **argv) { msk_trans_t *trans, *listen_trans; msk_trans_attr_t trans_attr; char errbuf[PCAP_ERRBUF_SIZE]; char *pcap_file; pcap_t *pcap; size_t block_size = 0; uint32_t recv_num = 0; int banner = 0; int i, rc; uint8_t *rdmabuf; struct ibv_mr *mr; msk_data_t *data, *wdata; struct privatedata priv; // argument handling int option_index = 0; int op, last_op; char *tmp_s; static struct option long_options[] = { { "client", required_argument, 0, 'c' }, { "server", required_argument, 0, 's' }, { "banner", no_argument, 0, 'B' }, { "help", no_argument, 0, 'h' }, { "verbose", no_argument, 0, 'v' }, { "quiet", no_argument, 0, 'q' }, { "block-size", required_argument, 0, 'b' }, { "file", required_argument, 0, 'f' }, { "recv-num", required_argument, 0, 'r' }, { "no-check", no_argument, 0, 'n' }, { 0, 0, 0, 0 } }; memset(&trans_attr, 0, sizeof(msk_trans_attr_t)); memset(&priv, 0, sizeof(struct privatedata)); priv.docheck = 1; trans_attr.server = -1; // put an incorrect value to check if we're either client or server // sane values for optional or non-configurable elements trans_attr.debug = 1; trans_attr.max_recv_sge = 1; trans_attr.disconnect_callback = callback_disconnect; trans_attr.worker_count = -1; pcap_file = "pcap.out"; last_op = 0; while ((op = getopt_long(argc, argv, "[email C++ ERROR_LOG_REPORT函数代码示例 C++ ERROR_EXIT函数代码示例
|