comparison src/video/fbcon/SDL_fbelo.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
151 return 0; 151 return 0;
152 } 152 }
153 153
154 while (num_bytes) { 154 while (num_bytes) {
155 if ((*buffer_p == 0) && (buffer[0] != ELO_START_BYTE)) { 155 if ((*buffer_p == 0) && (buffer[0] != ELO_START_BYTE)) {
156 memcpy(&buffer[0], &buffer[1], num_bytes-1); 156 SDL_memcpy(&buffer[0], &buffer[1], num_bytes-1);
157 } 157 }
158 else { 158 else {
159 if (*buffer_p < ELO_PACKET_SIZE-1) { 159 if (*buffer_p < ELO_PACKET_SIZE-1) {
160 *checksum = *checksum + buffer[*buffer_p]; 160 *checksum = *checksum + buffer[*buffer_p];
161 *checksum = *checksum % 256; 161 *checksum = *checksum % 256;
331 int result = 0; 331 int result = 0;
332 332
333 struct termios mouse_termios; 333 struct termios mouse_termios;
334 334
335 /* try to read the calibration values */ 335 /* try to read the calibration values */
336 buffer = getenv("SDL_ELO_MIN_X"); 336 buffer = SDL_getenv("SDL_ELO_MIN_X");
337 if(buffer) { 337 if(buffer) {
338 ELO_MIN_X = atoi(buffer); 338 ELO_MIN_X = atoi(buffer);
339 } 339 }
340 buffer = getenv("SDL_ELO_MAX_X"); 340 buffer = SDL_getenv("SDL_ELO_MAX_X");
341 if(buffer) { 341 if(buffer) {
342 ELO_MAX_X = atoi(buffer); 342 ELO_MAX_X = atoi(buffer);
343 } 343 }
344 buffer = getenv("SDL_ELO_MIN_Y"); 344 buffer = SDL_getenv("SDL_ELO_MIN_Y");
345 if(buffer) { 345 if(buffer) {
346 ELO_MIN_Y = atoi(buffer); 346 ELO_MIN_Y = atoi(buffer);
347 } 347 }
348 buffer = getenv("SDL_ELO_MAX_Y"); 348 buffer = SDL_getenv("SDL_ELO_MAX_Y");
349 if(buffer) { 349 if(buffer) {
350 ELO_MAX_Y = atoi(buffer); 350 ELO_MAX_Y = atoi(buffer);
351 } 351 }
352 352
353 #ifdef DEBUG_MOUSE 353 #ifdef DEBUG_MOUSE
357 ELO_MIN_Y, 357 ELO_MIN_Y,
358 ELO_MAX_Y); 358 ELO_MAX_Y);
359 #endif 359 #endif
360 360
361 /* set comm params */ 361 /* set comm params */
362 memset(&mouse_termios, 0, sizeof(mouse_termios)); 362 SDL_memset(&mouse_termios, 0, sizeof(mouse_termios));
363 mouse_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL; 363 mouse_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
364 mouse_termios.c_cc[VMIN] = 1; 364 mouse_termios.c_cc[VMIN] = 1;
365 result = tcsetattr(fd, TCSANOW, &mouse_termios); 365 result = tcsetattr(fd, TCSANOW, &mouse_termios);
366 366
367 if (result < 0) { 367 if (result < 0) {
369 fprintf( stderr, "Unable to configure Elographics touchscreen port\n"); 369 fprintf( stderr, "Unable to configure Elographics touchscreen port\n");
370 #endif 370 #endif
371 return 0; 371 return 0;
372 } 372 }
373 373
374 memset(req, 0, ELO_PACKET_SIZE); 374 SDL_memset(req, 0, ELO_PACKET_SIZE);
375 req[1] = tolower(ELO_PARAMETER); 375 req[1] = tolower(ELO_PARAMETER);
376 if (!eloSendQuery(req, reply, fd)) { 376 if (!eloSendQuery(req, reply, fd)) {
377 #ifdef DEBUG_MOUSE 377 #ifdef DEBUG_MOUSE
378 fprintf( stderr, "Not at the specified rate or model 2310, will continue\n"); 378 fprintf( stderr, "Not at the specified rate or model 2310, will continue\n");
379 #endif 379 #endif
380 } 380 }
381 381
382 memset(req, 0, ELO_PACKET_SIZE); 382 SDL_memset(req, 0, ELO_PACKET_SIZE);
383 req[1] = tolower(ELO_ID); 383 req[1] = tolower(ELO_ID);
384 if (eloSendQuery(req, reply, fd)) { 384 if (eloSendQuery(req, reply, fd)) {
385 #ifdef DEBUG_MOUSE 385 #ifdef DEBUG_MOUSE
386 fprintf(stderr, "Ok, controller configured!\n"); 386 fprintf(stderr, "Ok, controller configured!\n");
387 #endif 387 #endif
391 fprintf( stderr, "Unable to ask Elographics touchscreen identification\n"); 391 fprintf( stderr, "Unable to ask Elographics touchscreen identification\n");
392 #endif 392 #endif
393 return 0; 393 return 0;
394 } 394 }
395 395
396 memset(req, 0, ELO_PACKET_SIZE); 396 SDL_memset(req, 0, ELO_PACKET_SIZE);
397 req[1] = ELO_MODE; 397 req[1] = ELO_MODE;
398 req[3] = ELO_TOUCH_MODE | ELO_STREAM_MODE | ELO_UNTOUCH_MODE; 398 req[3] = ELO_TOUCH_MODE | ELO_STREAM_MODE | ELO_UNTOUCH_MODE;
399 req[4] = ELO_TRACKING_MODE; 399 req[4] = ELO_TRACKING_MODE;
400 if (!eloSendControl(req, fd)) { 400 if (!eloSendControl(req, fd)) {
401 #ifdef DEBUG_MOUSE 401 #ifdef DEBUG_MOUSE
402 fprintf( stderr, "Unable to change Elographics touchscreen operating mode\n"); 402 fprintf( stderr, "Unable to change Elographics touchscreen operating mode\n");
403 #endif 403 #endif
404 return 0; 404 return 0;
405 } 405 }
406 406
407 memset(req, 0, ELO_PACKET_SIZE); 407 SDL_memset(req, 0, ELO_PACKET_SIZE);
408 req[1] = ELO_REPORT; 408 req[1] = ELO_REPORT;
409 req[2] = ELO_UNTOUCH_DELAY; 409 req[2] = ELO_UNTOUCH_DELAY;
410 req[3] = ELO_REPORT_DELAY; 410 req[3] = ELO_REPORT_DELAY;
411 if (!eloSendControl(req, fd)) { 411 if (!eloSendControl(req, fd)) {
412 #ifdef DEBUG_MOUSE 412 #ifdef DEBUG_MOUSE