//------------------------------------------------------------ LeerTableta() // static void LeerTableta(int i) { static unsigned char uchBuf[64]; static int nLength; static WACOMSTATE state = WACOMSTATE_INIT; //Lectura de un paquete if ( ( nLength = WacomReadRaw(ghTablet,uchBuf,sizeof(uchBuf)) ) < 0) return; //Interpretacion del paquete if (WacomParseData(ghTablet,uchBuf,nLength,&state)) return; //Lectura secuencial de los distintos valores del estado actual de la tableta if (state.uValid & BIT(WACOMFIELD_PROXIMITY)) gAbsState[WACOMFIELD_PROXIMITY].nValue = state.values[WACOMFIELD_PROXIMITY].nValue; if (state.uValid & BIT(WACOMFIELD_POSITION_X)) gAbsState[WACOMFIELD_POSITION_X].nValue = state.values[WACOMFIELD_POSITION_X].nValue; if (state.uValid & BIT(WACOMFIELD_POSITION_Y)) gAbsState[WACOMFIELD_POSITION_Y].nValue = state.values[WACOMFIELD_POSITION_Y].nValue; if (state.uValid & BIT(WACOMFIELD_PRESSURE)) gAbsState[WACOMFIELD_PRESSURE].nValue = state.values[WACOMFIELD_PRESSURE].nValue; /* for (i=WACOMFIELD_TOOLTYPE; i<WACOMFIELD_MAX; ++i) if (state.uValid & BIT(i)) gAbsState[i].nValue = state.values[i].nValue; } Para leer todos los campos*/ /* Call the user defined callback function */ if (gCallback) gCallback(i); }
static LONG WINAPI unhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo) { if (gCallback) { gCallback(); } if (prevExceptionFilter) { return prevExceptionFilter(pExceptionInfo); } else { return EXCEPTION_CONTINUE_SEARCH; } }
/* * See also: * - http://sourceware.org/git/?p=glibc.git;a=blob;f=debug/segfault.c * - http://ggi.cvs.sourceforge.net/viewvc/ggi/ggi-core/libgg/gg/cleanup.c?view=markup */ static void signalHandler(int sig, siginfo_t *info, void *context) { /* * There are several signals that can happen when logging to stdout/stderr. * For example, SIGPIPE will be emitted if stderr is a pipe with no * readers. Therefore ignore any signal while logging by returning * immediately, to prevent deadlocks. */ if (logging) { return; } static int recursion_count = 0; log("apitrace: warning: caught signal %i\n", sig); if (recursion_count) { log("apitrace: warning: recursion handling signal %i\n", sig); } else { if (gCallback) { ++recursion_count; gCallback(); --recursion_count; } } struct sigaction *old_action; if (sig >= NUM_SIGNALS) { /* This should never happen */ log("error: unexpected signal %i\n", sig); raise(SIGKILL); } old_action = &old_actions[sig]; if (old_action->sa_flags & SA_SIGINFO) { // Handler is in sa_sigaction old_action->sa_sigaction(sig, info, context); } else { if (old_action->sa_handler == SIG_DFL) { log("apitrace: info: taking default action for signal %i\n", sig); #if 1 struct sigaction dfl_action; dfl_action.sa_handler = SIG_DFL; sigemptyset (&dfl_action.sa_mask); dfl_action.sa_flags = 0; sigaction(sig, &dfl_action, NULL); raise(sig); #else raise(SIGKILL); #endif } else if (old_action->sa_handler == SIG_IGN) { /* ignore */ } else { /* dispatch to handler */ old_action->sa_handler(sig); } } }