void write_ulong(unsigned long num,unsigned long cum,unsigned long dat, const char *fn,const char *fnn) /* write num to "fnn" add ':' & cum if cum <>0, then move "fnn" to "fn" */ { int fd; fd = open_trunc(fnn); if (fd == -1) strerr_die2sys(111,FATAL,MSG1(ERR_CREATE,fnn)); substdio_fdbuf(&ssnum,write,fd,numbuf,sizeof(numbuf)); if (substdio_put(&ssnum,strnum,fmt_ulong(strnum,num)) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); if (substdio_puts(&ssnum,":") == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); if (substdio_put(&ssnum,strnum,fmt_ulong(strnum,cum)) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); if (dat) { if (substdio_puts(&ssnum,":") == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); if (substdio_put(&ssnum,strnum,fmt_ulong(strnum,dat)) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); } if (substdio_puts(&ssnum,"\n") == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnn)); if (substdio_flush(&ssnum) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_FLUSH,fnn)); if (fsync(fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_SYNC,fnn)); if (close(fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_CLOSE,fnn)); wrap_rename(fnn,fn); }
int thzclos(Process *proc, port_ent *peptr, int elem_no) { //Process *sptr; cp *cpp; //Cnxt *cnp; //IPh *IPptr; //IPh *nextIP; cpp = (cp *)peptr -> cpptr; if (peptr -> ret_code == 2) return(2); if (cpp -> elem_list[elem_no].closed) return(1); if (proc->trace) MSG1("%s Close\n",proc -> procname); thziclos(proc, cpp, elem_no); cpp -> elem_list[elem_no].closed = TRUE; if (proc->trace) MSG1("%s Close end\n", proc -> procname); return(0); }
static void do_get(const char *action) { unsigned long u; struct stat st; char ch; int r; unsigned int pos; int fd; if (!flagget) strerr_die2x(100,FATAL,MSG(ERR_NOT_AVAILABLE)); hdr_subject(MSG(SUB_GET_MSG)); hdr_ctboundary(); copy(&qq,"text/top",flagcd); pos = str_len(ACTION_GET); if (!case_starts(action,ACTION_GET)) pos = str_len(ALT_GET); if (action[pos] == '.' || action [pos] == '_') pos++; scan_ulong(action + pos,&u); stralloc_copys(&line,"archive/"); stralloc_catb(&line,strnum,fmt_ulong(strnum,u / 100)); stralloc_cats(&line,"/"); stralloc_catb(&line,strnum,fmt_uint0(strnum,(unsigned int) (u % 100),2)); stralloc_0(&line); fd = open_read(line.s); if (fd == -1) if (errno != error_noent) strerr_die2sys(111,FATAL,MSG1(ERR_OPEN,line.s)); else copy_act("text/get-bad"); else { if (fstat(fd,&st) == -1) copy_act("text/get-bad"); else if (!(st.st_mode & 0100)) copy_act("text/get-bad"); else { showsend("get"); substdio_fdbuf(&sstext,read,fd,textbuf,sizeof(textbuf)); qmail_puts(&qq,"> "); for (;;) { r = substdio_get(&sstext,&ch,1); if (r == -1) strerr_die2sys(111,FATAL,MSG1(ERR_READ,line.s)); if (r == 0) break; qmail_put(&qq,&ch,1); if (ch == '\n') qmail_puts(&qq,"> "); } qmail_puts(&qq,"\n"); } close(fd); } copybottom(0); qmail_to(&qq,target.s); }
SCF_STATE CAM_SM::PowerUp_STC_CheckCoin(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("PowerUp_STC_CheckCoin-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_CheckCoin-SCF_STATE_ENTRY_SIG", (&mENSComponent)); // Get coin value pIspctlCom->queuePE(Sensor_Tuning_Status_e_Coin_SubBlock_Status_Byte0,0); pIspctlCom->readQueue(); return 0; } case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("PowerUp_STC_CheckCoin-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_CheckCoin-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if (e->type.ispctlInfo.info_id != ISP_READLIST_DONE) break; //#if defined (OSI_DEBUG) for(t_uint16 i=0; i < e->type.ispctlInfo.number_of_pe; i++) { MSG4(" PE[%d] 0x%X (%s) = 0x%lX\n", i, e->type.ispctlInfo.Listvalue[i].pe_addr, pSensor->GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); //OstTraceFiltStatic4(TRACE_DEBUG, " PE[%d] 0x%X (%s) = 0x%lX", (&mENSComponent), i, e->type.ispctlInfo.Listvalue[i].pe_addr, CXp70::GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); } //#endif if( (Coin_te)e->type.ispctlInfo.Listvalue[0].pe_data == iStatusCoin) { // Coin state has not changed yet if(iStatusCoinRetriesCount>=10) { MSG0("***** Coin state unchanged, too many attempts *****\n"); OstTraceFiltStatic0(TRACE_DEBUG, "***** Coin state unchanged, too many attempts *****", (&mENSComponent)); DBC_ASSERT(0); return 0; } MSG1(" Coin state unchanged (state=%d) => try again\n", (int)iStatusCoin); OstTraceFiltStatic1(TRACE_DEBUG, "Coin state unchanged (state=%d) => try again", (&mENSComponent), (int)iStatusCoin); iStatusCoinRetriesCount++; pIspctlCom->queuePE(Sensor_Tuning_Status_e_Coin_SubBlock_Status_Byte0,0); pIspctlCom->readQueue(); } else { // Coin state changed => we can read the block ID value iStatusCoin = (Coin_te) e->type.ispctlInfo.Listvalue[0].pe_data; MSG1(" Coin state unchanged (state=%d) => read Block ID value\n", (int)iStatusCoin); OstTraceFiltStatic1(TRACE_DEBUG, "Coin state unchanged (state=%d) => read Block ID value", (&mENSComponent), (int)iStatusCoin); iStatusCoinRetriesCount = 0; SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_ReadId); } return 0; } case SCF_STATE_EXIT_SIG: { EXIT; return 0; } default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
void f_close(void) { if (substdio_flush(&ss) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_FLUSH,dirplus.s)); if (fsync(ss.fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_SYNC,dirplus.s)); if (close(ss.fd) == -1) /* NFS stupidity */ strerr_die2sys(111,FATAL,MSG1(ERR_CLOSE,dirplus.s)); keyaddtime(); }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::doSpecificEventHandler_cb(OMX_EVENTTYPE _event, OMX_U32 nData1, OMX_U32 nData2, OMX_BOOL &deferredEvent) //************************************************************************************************************* { IN0("\n"); switch ((unsigned int)_event) { case OMX_EventCmdComplete: if (nData1 == OMX_CommandStateSet) { //Only idle and executing are trapped! MSG3("OMX_EventCmdComplete %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) ); } else // encapsulate OMX_EventPortSettingsChanged & OMX_EventBufferFlag MSG3("OMX_EventCmdComplete %s.%s(%d)\n", GetComponentName(), GetStringOmxCommand(nData1), (int)nData2); break; case OMX_EventError: MSG1("OMX_EventError %ld\n", nData1); break; case OMX_EventMark: MSG0("OMX_EventMark\n"); break; case OMX_EventPortSettingsChanged: MSG1("OMX_EventPortSettingsChanged(%d)\n", (int)nData1); break; case OMX_EventBufferFlag: if(nData2 == OMX_BUFFERFLAG_EOS) { MSG1("OMX_EventBufferFlag('EOS') on port %ld\n", nData1); } else MSG2("OMX_EventBufferFlag(%ld) on port %ld\n", nData2, nData1); break; case OMX_EventResourcesAcquired: MSG0("OMX_EventResourcesAcquired\n"); break; case OMX_EventComponentResumed: MSG0("OMX_EventComponentResumed\n"); break; case OMX_EventDynamicResourcesAvailable: MSG0("OMX_EventDynamicResourcesAvailable\n"); break; case OMX_EventPortFormatDetected: MSG0("OMX_EventPortFormatDetected\n"); break; case OMX_EventIndexSettingChanged: MSG0("OMX_EventIndexSettingChanged\n"); break; case OMX_EventCmdReceived: if (nData1 == OMX_CommandStateSet) { //Only idle and executing are trapped! MSG3("OMX_EventCmdReceived %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) ); } else MSG3("OMX_EventCmdReceived %s.%s(%ld)\n", GetComponentName(), GetStringOmxCommand(nData1), (long)nData2); break; default: MSG3("unknown OMX_Event(%d, %d, %d)\n", _event, (int)nData1, (int)nData2); break; } // Don't send any more this command because it duplicate OMX_EventBufferFlag messages //((OpenMax_Component*)&mENSComponent)->eventHandler(_event, nData1, nData2) ; OUT0("\n"); return OMX_ErrorNone; }
void close_proper(substdio *ss,const char *s,const char *sn) /* flush,sync,close,move sn->s) */ { if (substdio_flush(ss) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_FLUSH,s)); if (flagsync) if (fsync(ss->fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_SYNC,s)); if (close(ss->fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_CLOSE,s)); wrap_rename(sn,s); }
const char *get_from(const char *adr, /* target address */ const char *act) /* action */ /* If we captured a from line, it will be from the subscriber, except */ /* when -S is used when it's usually from the subscriber, but of course */ /* could be from anyone. The matching to stored data is required only */ /* to support moderated lists, and in cases where a new -sc is issued */ /* because an old one was invalid. In this case, we read through the */ /* from file trying to match up a timestamp with that starting in */ /* *(act+3). If the time stamp matches, we compare the target address */ /* itself. act + 3 must be a legal part of the string returns pointer to*/ /* fromline, NULL if not found. Since the execution time from when to */ /* storage may differ, we can't assume that the timestamps are in order.*/ { int fd; const char *fl; unsigned int pos; unsigned long thistime; unsigned long linetime; if (!flagstorefrom) return 0; if (fromline.len) { /* easy! We got it in this message */ stralloc_0(&fromline); return fromline.s; } /* need to recover it from DIR/from */ fl = 0; (void) scan_ulong(act+3,&thistime); if ((fd = open_read("from")) == -1) { if (errno == error_noent) return 0; else strerr_die2sys(111,FATAL,MSG1(ERR_READ,"from")); } substdio_fdbuf(&sstext,read,fd,textbuf,(int) sizeof(textbuf)); for (;;) { if (getln(&sstext,&fromline,&match,'\n') == -1) strerr_die2sys(111,FATAL,MSG1(ERR_READ,"from")); if (!match) break; fromline.s[fromline.len - 1] = (char) 0; /* now:time addr\0fromline\0 read all. They can be out of order! */ pos = scan_ulong(fromline.s,&linetime); if (linetime != thistime) continue; if (!str_diff(fromline.s + pos + 1,adr)) { pos = str_len(fromline.s); if (pos < fromline.len) { fl = fromline.s + pos + 1; break; } } } close(fd); return fl; }
/* * Size method */ void fileio::size(const char* aFileName, t_uint32* aSizePtr) { ASYNC_IN0(""); FILE* theFile = NULL; // Sanity check if( aFileName == NULL || aSizePtr == NULL) { // bad parameter MSG2("Bad parameter: aFileName=%p, aSizePtr=%p\n", aFileName, aSizePtr); response.fileIoResponse(FILE_IO_BAD_PARAMETER); ASYNC_OUT0(""); return; } // Open the file MSG1("Opening file '%s' for reading\n", aFileName); theFile = fopen( aFileName, "rb"); if(theFile==NULL) { // could not open the file MSG1("File '%s' open failed\n", aFileName); response.fileIoResponse(FILE_IO_OPEN_FAILED); ASYNC_OUT0(""); return; } // Seek to end of file MSG1("Seeking to end of file '%s'\n", aFileName); if( fseek( theFile, 0, SEEK_END) != 0) { // seek failed MSG0("Seek failed"); MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_SEEK_FAILED); ASYNC_OUT0(""); return; } // Retrieve file size *aSizePtr = (t_uint32)ftell(theFile); MSG2("File '%s' size %ld\n", aFileName, *aSizePtr); // File size sucessfully retrieved MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_OK); ASYNC_OUT0(""); return; }
void linkdotdir(const char *dash,const char *slash) { stralloc_copy(&dotplus,&dot); stralloc_cats(&dotplus,dash); stralloc_0(&dotplus); dirplusmake(slash); if (flags['e' - 'a']) if (unlink(dotplus.s) == -1) if (errno != error_noent) strerr_die2sys(111,FATAL,MSG1(ERR_DELETE,dotplus.s)); if (symlink(dirplus.s,dotplus.s) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_CREATE,dotplus.s)); keyaddtime(); }
/* * Write method */ void fileio::write(const char* aFileName, const void* aSrcBuffer, t_uint32 aNumBytes) { ASYNC_IN0(""); FILE* theFile = NULL; size_t writtenBytesCount = 0; // Sanity check if( aFileName == NULL || aSrcBuffer == NULL || aNumBytes == 0) { // bad parameter MSG3("Bad parameter: aFileName=%p aSrcBuffer=%p aNumBytes=%ld\n", aFileName, aSrcBuffer, aNumBytes); response.fileIoResponse(FILE_IO_BAD_PARAMETER); ASYNC_OUT0(""); return; } // Open the file MSG1("Opening file '%s' for writing\n", aFileName); theFile = fopen( aFileName, "wb"); if(theFile==NULL) { // could not open the file MSG1("File '%s' open failed\n", aFileName); response.fileIoResponse(FILE_IO_OPEN_FAILED); ASYNC_OUT0(""); return; } // Actual write MSG2("Writing %ld bytes to file '%s'\n", aNumBytes, aFileName); writtenBytesCount = fwrite( aSrcBuffer, 1, (size_t)aNumBytes, theFile); if( writtenBytesCount != aNumBytes ) { // could not write into file MSG0("Write failed\n"); MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_WRITE_FAILED); ASYNC_OUT0(""); return; } // File sucessfully written MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_OK); ASYNC_OUT0(""); return; }
/* * Read method */ void fileio::read(const char* aFileName, void* aDestBuffer, t_uint32 aNumBytes) { ASYNC_IN0(""); FILE* theFile = NULL; size_t readBytesCount = 0; // Sanity check if( aFileName == NULL || aDestBuffer == NULL || aNumBytes == 0) { // bad parameter MSG3("Bad parameter: aFileName=%p aDestBuffer=%p aNumBytes=%ld\n", aFileName, aDestBuffer, aNumBytes); response.fileIoResponse(FILE_IO_BAD_PARAMETER); ASYNC_OUT0(""); return; } // Open the file MSG1("Opening file '%s' for reading\n", aFileName); theFile = fopen( aFileName, "rb"); if(theFile==NULL) { // could not open the file MSG1("File '%s' open failed\n", aFileName); response.fileIoResponse(FILE_IO_OPEN_FAILED); ASYNC_OUT0(""); return; } // Read the file MSG2("Reading %ld bytes from file '%s'\n", aNumBytes, aFileName); readBytesCount = fread( aDestBuffer, 1, (size_t)aNumBytes, theFile); if( readBytesCount != aNumBytes ) { // could not read the file MSG2("Read failed, expected %ld bytes, actually got %d bytes\n", aNumBytes, readBytesCount); MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_READ_FAILED); ASYNC_OUT0(""); return; } // File sucessfully read MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_OK); ASYNC_OUT0(""); return; }
camSharedMemError_t CCamSharedMemory::cacheInvalidate(camSharedMemChunkId_t chunkId) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CCamSharedMemory::cacheInvalidate", (mTraceObject)); if (state != CCamSharedMemory::CAM_SHARED_MEM_STATE_OPEN) { OUT0("\n"); OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheInvalidate (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_STATE); return CAM_SHARED_MEM_ERR_BAD_STATE; } if (chunkId >= CAM_SHARED_MEM_CHUNK_MAX) { OUT0("\n"); OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheInvalidate (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_PARAMETER); return CAM_SHARED_MEM_ERR_BAD_PARAMETER; } if (! abBusyChunks[chunkId]) { OUT0("\n"); OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheInvalidate (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_BAD_PRECONDITION); return CAM_SHARED_MEM_ERR_BAD_PRECONDITION; } // Flush the data that have been written by the ISP FW OMX_U32 aPhysAddr; // out OMX_ERRORTYPE e_ret = sharedBufferPoolId->CacheSync(MMHwBuffer::ESyncAfterWriteHwOperation, (OMX_U32) aChunks[chunkId].armLogicalAddress, aChunks[chunkId].size, aPhysAddr); if (e_ret != OMX_ErrorNone) { MSG1("Problem invalidating data cache (err=%d)\n", e_ret); OstTraceFiltStatic1(TRACE_DEBUG, "Problem invalidating data cache (err=%d)", (mTraceObject), e_ret); OUT0("\n"); OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheInvalidate (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_NO_RESOURCE); return CAM_SHARED_MEM_ERR_NO_RESOURCE; } OUT0("\n"); OstTraceFiltStatic1(TRACE_FLOW, "Exit CCamSharedMemory::cacheInvalidate (%d)", (mTraceObject), CAM_SHARED_MEM_ERR_NONE); return CAM_SHARED_MEM_ERR_NONE; }
/* * NMF callback */ void CTuningLoaderManager::response(t_tuningloader_error aErr) { ASYNC_IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::response", (mTraceObject)); s_scf_event event; if(aErr==TUNING_LOADER_OK) { // NMF operation done: prepare COM_SM event MSG0("NMF operation completed\n"); OstTraceFiltStatic0(TRACE_DEBUG, "NMF operation completed", (mTraceObject)); event.sig = TUNING_LOADER_OPERATION_DONE_SIG; event.type.tuningLoaderEvent.error = TUNING_LOADER_OK; } else { // NMF operation failed: prepare COM_SM event MSG1("NMF operation failed: err=%d\n", aErr); OstTraceFiltStatic1(TRACE_ERROR, "NMF operation failed: err=%d", (mTraceObject), aErr); // Note: here the function iNmfSyncIntf.errorCode2String() cannot be called // as CTuningLoaderManager::response callback is called in the context of the ENS // Wrapper which has no reference to iNmfErrorIntf event.sig = TUNING_LOADER_OPERATION_FAILED_SIG; event.type.tuningLoaderEvent.error = aErr; } iSM->ProcessEvent(&event); ASYNC_OUT0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Exit CTuningLoaderManager::response", (mTraceObject)); }
void CFlashSequencer::sigTimer() { IN0("\n"); cam_flashSeq_atom_t const *pSeq = NULL; if (i32_remSteps > 0) { // Some flash action still to be done switch (curSeq) { default: case NONE_SEQ: DBGT_ERROR("CFlashSequencer::sigTimer - Error: NONE_SEQ cannot be ticked.\n"); OstTraceFiltStatic0(TRACE_ERROR, "CFlashSequencer::sigTimer - Error: NONE_SEQ cannot be ticked.", (mTraceObject)); break; case RED_EYE_REMOVAL_SEQ: pSeq = &a_RER_sequence[sizeof(a_RER_sequence) / sizeof(cam_flashSeq_atom_t) - i32_remSteps]; break; case PRIVACY_SEQ: pSeq = &a_PI_sequence[sizeof(a_PI_sequence) / sizeof(cam_flashSeq_atom_t) - i32_remSteps]; break; } if (NULL != pSeq) { doAtom(pSeq); } i32_remSteps--; } else { // End of sequence: call the user back if requested, and clean the request. MSG1("CFlashSequencer::sigTimer - Sequence %d completed.\n", curSeq); curSeq = NONE_SEQ; if (mpClbk != NULL) { mpClbk(mctxtHnd); mpClbk = NULL; mctxtHnd = NULL; } } OUT0("\n"); }
void openmax_processor::setParam(t_sint32 portIndex, t_sint32 fifoSize, t_sint32 direction, t_sint32 buffSupplierType, t_sint32 correspondingPortIndex, t_sint32 width, t_sint32 height, t_sint32 colorFormat, t_sint32 stride) //************************************************************************************************************* { //DEfault initialisation of the ports IN0("\n"); MSG4("portIndex %ld, fifoSize %ld, direction %ld, buffSupplierType%ld\n", portIndex, fifoSize, direction, buffSupplierType); MSG4("correspondingPortIndex %ld, width %ld, height %ld, colorFormat %ld\n", correspondingPortIndex, width, height, colorFormat); MSG1("stride %ld\n", stride); if(portIndex >= (int)GetNbPorts()) // Sanity check { MSG0("ERROR in setParam OMX_ErrorBadParameter\n"); OUTR(" Error", OMX_ErrorBadParameter); return; } portInformation*pInfo= GetPortInfo(portIndex); if (pInfo) { pInfo->fifoSize = fifoSize; pInfo->width = width; pInfo->height = height; pInfo->colorFormat = (OMX_COLOR_FORMATTYPE)colorFormat; pInfo->omxPortIndex = portIndex; pInfo->stride = stride; pInfo->direction = (OMX_DIRTYPE) direction; pInfo->bufferSupplier= buffSupplierType; pInfo->omxPortIndex = correspondingPortIndex; } OUT0("\n"); }
/* * This function launches the loading of the flash tuning data */ TuningLoaderMgrError_t CTuningLoaderManager::loadFlashTuningData(const t_flash_info* pFlashInfo) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::loadFlashTuningData", (mTraceObject)); // Check if constructed if(iNmfInstance == NULL) { MSG0("Instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "Instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } // Aguments sanity check if( pFlashInfo == NULL) { MSG1("Bad argument: pFlashInfo=%p\n", pFlashInfo); OstTraceFiltStatic1(TRACE_ERROR, "Bad argument: pFlashInfo=0x%x", (mTraceObject), (t_uint32)pFlashInfo); OUTR(" ",TUNING_LOADER_MGR_BAD_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_BAD_ARGUMENT); return TUNING_LOADER_MGR_BAD_ARGUMENT; } // Send command to NMF MSG0("Send 'loadFlashTuning' command to NMF\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Send 'loadFlashTuning' command to NMF", (mTraceObject)); iNmfQueryIntf.loadFlashTuning(*pFlashInfo); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
void frm(const char *slash) { dirplusmake(slash); if (unlink(dirplus.s) == -1) if (errno != error_noent) strerr_die2sys(111,FATAL,MSG1(ERR_DELETE,dirplus.s)); }
static TTRPtr TT_GetRow_(void *tth) { int nread=0,badline=0,comment,i; char str[MAXSTRLNG], *s, nm[10]; static TTRow r; unsigned long tag; /* for backward compartibility */ if (UseMYSQL) { MYSQL_NOT_IMPLEMENTED; return NULL; } else { do { s=fgets(str,MAXSTRLNG,(FILE*)tth); nline++; if (s == NULL) { if (ferror((FILE*)tth)) /* check for errors */ { MSG1("Error reading TT file at line # %i\n",nline); perror("TT_GetRow_: Error in fgets()"); } if (feof ((FILE*)tth)) /* check for End-Of-File */ { ; /* MSG1("Found end of TT file at line # %i\n",nline); */ } return NULL; /* Stop reading */ } str[strlen(str)-1] = 0; comment = (*str==0 || *str=='#' || *str=='!' || *str==';') ; badline = 0; /* printf("String %i: <%s>",nline,str); */ if (!comment) { nread = sscanf (str,"%4c %i %i %i %i %i %i %i %i %i %i", &r.nm,&r.nr,&r.sd1,&r.sd2,&r.pl,&tag, &r.st,&r.roc,&r.sl,&r.typ,&r.chn); /*printf("=+=> %x(%d) %x(%d)\n",r.sd1,r.sd1,r.sd2,r.sd2);*/ /* printf(" : <%s>\n",&r.nm); */ badline = (nread != NUMTTFIELDS + 1); /* one extra field in line (tag) */ if (badline) { MSG4("Error pasing line # %i of TT file ; nItems=%i Nfields=%i ; \n" "Line was:\"%s\"\n",nline,nread,NUMTTFIELDS-1,str); /* return NULL; */ } } else { ; /* MSG1("Found comment at line # %i\n",nline); */ } } while(comment || badline); return(&r); } }
void printKeymap(void) { MSG("xkb_keymap {\n"); if (svValue[KEYCODES_NDX]) MSG1("\txkb_keycodes { include \"%s\"\t};\n", svValue[KEYCODES_NDX]); if (svValue[TYPES_NDX]) MSG1("\txkb_types { include \"%s\"\t};\n", svValue[TYPES_NDX]); if (svValue[COMPAT_NDX]) MSG1("\txkb_compat { include \"%s\"\t};\n", svValue[COMPAT_NDX]); if (svValue[SYMBOLS_NDX]) MSG1("\txkb_symbols { include \"%s\"\t};\n", svValue[SYMBOLS_NDX]); if (svValue[GEOMETRY_NDX]) MSG1("\txkb_geometry { include \"%s\"\t};\n", svValue[GEOMETRY_NDX]); MSG("};\n"); }
SCF_STATE CAM_SM::ZSLHDRCapture(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("HDR: CAM_SM::ZSLHDRCapture- SCF_STATE_ENTRY_SIG\n"); pResourceSharerManager->mRSPing.Ping(0); return 0; } case Q_PONG_SIG: { ((COmxCamera*)&mENSComponent)->eStateZSLHDR = ZSLHDRState_TakeCapture; MSG0("HDR: CAM_SM::ZSLHDRCapture - Q_PONG_SIG\n"); pOpModeMgr->ConfigCapturing[RawCapturePort] = OMX_TRUE; pOpModeMgr->UpdateCurrentOpMode(); OMX_ERRORTYPE err = OMX_ErrorNone; err = pOpModeMgr->Compute_NumberOfBuffersForStill(); if (OMX_ErrorNone != err) { DBC_ASSERT(0); } MSG1("HDR: pOpModeMgr->NumberOfBuffersForStill = %d\n", pOpModeMgr->NumberOfBuffersForStill); pGrabControl->startBurstCapture(CAMERA_PORT_OUT1, pOpModeMgr->NumberOfBuffersForStill); p3AComponentManager->setMode(SW3A_MODE_SET_HDR_CAPTURE, 0); SCF_TRANSIT_TO(&CAM_SM::ProcessPendingEvents); return 0; } case SCF_STATE_EXIT_SIG: EXIT; return 0; default: break; } return SCF_STATE_PTR(&CAM_SM::ProcessPendingEvents); }
TuningLoaderMgrError_t CTuningLoaderManager::saveNvmTuningData(const t_camera_info* pCamInfo,unsigned char* pNvm, t_uint32 aSize) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::saveNvmTuningData", (mTraceObject)); // Check if constructed if(iNmfInstance == NULL) { MSG0("Instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "Instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } // Aguments sanity check if( (pCamInfo == NULL) || (pNvm ==NULL) || (aSize == 0)) { MSG1("Bad argument: pCamInfo=%x, pNvm=0x%x, aSize=%x\n", (unsigned int)pCamInfo,(unsigned int)pNvm,(unsigned int)aSize); OstTraceFiltStatic3(TRACE_ERROR, "Bad argument: pCamInfo=0x%x pNvm=0x%x, aSize=%d", (mTraceObject), (t_uint32)pCamInfo,(t_uint32)pNvm,aSize); OUTR(" ",TUNING_LOADER_MGR_BAD_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_BAD_ARGUMENT); return TUNING_LOADER_MGR_BAD_ARGUMENT; } // Send command to NMF MSG0("Send 'SaveNvmTuning' command to NMF\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Send 'loadNvmTuning' command to NMF", (mTraceObject)); iNmfQueryIntf.saveNvmTuning(*pCamInfo,(t_uint32)pNvm,aSize); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
void printKeymap(void) { MSG("xkb_keymap {\n"); if (settings.keycodes.value) MSG1("\txkb_keycodes { include \"%s\"\t};\n", settings.keycodes.value); if (settings.types.value) MSG1("\txkb_types { include \"%s\"\t};\n", settings.types.value); if (settings.compat.value) MSG1("\txkb_compat { include \"%s\"\t};\n", settings.compat.value); if (settings.symbols.value) MSG1("\txkb_symbols { include \"%s\"\t};\n", settings.symbols.value); if (settings.geometry.value) MSG1("\txkb_geometry { include \"%s\"\t};\n", settings.geometry.value); MSG("};\n"); }
void usage(int argc, char **argv) { MSG1( "Usage: %s [options] [<layout> [<variant> [<option> ... ]]]\n" "Options:\n" " -?, -help Print this message\n" " -compat <name> Specifies compatibility map component name\n" " -config <file> Specifies configuration file to use\n" " -device <deviceid> Specifies the device ID to use\n" " -display <dpy> Specifies display to use\n" " -geometry <name> Specifies geometry component name\n" " -I<dir> Add <dir> to list of directories to be used\n" " -keycodes <name> Specifies keycodes component name\n" " -keymap <name> Specifies name of keymap to load\n" " -layout <name> Specifies layout used to choose component names\n" " -model <name> Specifies model used to choose component names\n" " -option <name> Adds an option used to choose component names\n" " -print Print a complete xkb_keymap description and exit\n" " -query Print the current layout settings and exit\n" " -rules <name> Name of rules file to use\n" " -symbols <name> Specifies symbols component name\n" " -synch Synchronize request with X server\n" " -types <name> Specifies types component name\n" " -v[erbose] [<lvl>] Sets verbosity (1..10). Higher values yield\n" " more messages\n" " -variant <name> Specifies layout variant used to choose component names\n", argv[0] ); }
int getoff(const char *action) { int r; r = subscribe(workdir,target.s,0,"",(*action == ACTION_WC[0]) ? "-mod" : "-",-1); if (flagdig == FLD_DENY || flagdig == FLD_ALLOW) strerr_die2x(0,INFO,MSG1(ERR_EXTRA_UNSUB,target.s)); switch (r) { /* no comment for unsubscribe */ case 1: hdr_subject(MSG(SUB_GOODBYE)); qmail_puts(&qq,"\n"); hdr_ctboundary(); copy(&qq,"text/top",flagcd); copy_act("text/unsub-ok"); break; default: hdr_subject(MSG(SUB_UNSUBSCRIBE_NOP)); hdr_ctboundary(); copy(&qq,"text/top",flagcd); copy_act("text/unsub-nop"); break; } return r; }
static int open_template(stralloc *fn) { int fd; struct stat st; stralloc_0(fn); if (stat(fn->s,&st) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_STAT,fn->s)); if (S_ISDIR(st.st_mode)) { --fn->len; stralloc_cats(fn,TXT_EZMLMRC); stralloc_0(fn); } if ((fd = open_read(fn->s)) == -1) { if (errno != error_noent) strerr_die2sys(111,FATAL,MSG1(ERR_OPEN,fn->s)); else strerr_die3x(100,FATAL,template.s,MSG(ERR_NOEXIST));
static void flushit(int fd) { if (fd > 0) if (substdio_flush(&ssarchive) == -1 || fchmod(fd,MODE_ARCHIVE|0700) == -1 || close(fd) == -1) strerr_die2sys(111,FATAL,MSG1(ERR_WRITE,fnaf.s)); }
int wrap_stat(const char *fn,struct stat *st) { int r; if ((r = stat(fn,st)) == -1 && errno != error_noent) strerr_die2sys(111,FATAL,MSG1(ERR_STAT,fn)); return r; }
void dcreate(const char *slash) { dirplusmake(slash); if (mkdir(dirplus.s,0755) == -1) if ((errno != error_exist) || !flags['e' - 'a']) strerr_die2sys(111,FATAL,MSG1(ERR_CREATE,dirplus.s)); keyaddtime(); }
/* * Search and open a file for reading */ t_fileio_error tuningloader_fileio::search(const char** pPaths, const int aNumPaths, const char* pFileName) { IN0("\n"); // Close file in case previous one is still open if(pFile!=NULL) { MSG0("Attenmting to open a new file without having closed previous one\n"); OUTR(" ",FILEIO_FILE_NOT_CLOSED); return FILEIO_FILE_NOT_CLOSED; } // Loop on all root paths for(int i=0; i<aNumPaths; i++) { // Contruct file name snprintf(iFullyQualifiedFileName, sizeof(iFullyQualifiedFileName), "%s/%s", pPaths[i], pFileName); // Open file MSG1("Opening file (read only) '%s'\n", iFullyQualifiedFileName); pFile = fopen( iFullyQualifiedFileName, "rb"); if(pFile!=NULL) { // File sucessfully open, retrieve file size if( fseek( pFile, 0, SEEK_END) != 0) { // Seek failed MSG0("Failed to seek to end of file, aborting\n"); close(); OUTR(" ", FILEIO_SEEK_FAILED); return FILEIO_SEEK_FAILED; } iFileSize = (int)ftell(pFile); MSG1("File found, size=%d\n", iFileSize); (void)fseek(pFile, 0, SEEK_SET); OUTR(" ", FILEIO_OK); return FILEIO_OK; } MSG0("File not found, try next path\n"); } MSG0("All paths have been visited, file not found\n"); OUTR(" ", FILEIO_OPEN_FAILED); return FILEIO_OPEN_FAILED; }