Mercurial > repos > blastem
comparison io.c @ 1792:52a47611a273
Avoid printing a bunch of junk to stdout when GDB remote debugging is enabled as this can confuse GDB
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 20 Mar 2019 22:05:27 -0700 |
parents | 1843823f1e9b |
children | e7a516f08cec |
comparison
equal
deleted
inserted
replaced
1791:1843823f1e9b | 1792:52a47611a273 |
---|---|
333 if (!pipe_name) | 333 if (!pipe_name) |
334 { | 334 { |
335 warning("IO port %s is configured to use the sega parallel board, but no paralell_pipe is set!\n", io_name(i)); | 335 warning("IO port %s is configured to use the sega parallel board, but no paralell_pipe is set!\n", io_name(i)); |
336 ports[i].device_type = IO_NONE; | 336 ports[i].device_type = IO_NONE; |
337 } else { | 337 } else { |
338 printf("IO port: %s connected to device '%s' with pipe name: %s\n", io_name(i), device_type_names[ports[i].device_type], pipe_name); | 338 debug_message("IO port: %s connected to device '%s' with pipe name: %s\n", io_name(i), device_type_names[ports[i].device_type], pipe_name); |
339 if (!strcmp("stdin", pipe_name)) | 339 if (!strcmp("stdin", pipe_name)) |
340 { | 340 { |
341 ports[i].device.stream.data_fd = STDIN_FILENO; | 341 ports[i].device.stream.data_fd = STDIN_FILENO; |
342 } else { | 342 } else { |
343 if (mkfifo(pipe_name, 0666) && errno != EEXIST) | 343 if (mkfifo(pipe_name, 0666) && errno != EEXIST) |
359 if (!sock_name) | 359 if (!sock_name) |
360 { | 360 { |
361 warning("IO port %s is configured to use generic IO, but no socket is set!\n", io_name(i)); | 361 warning("IO port %s is configured to use generic IO, but no socket is set!\n", io_name(i)); |
362 ports[i].device_type = IO_NONE; | 362 ports[i].device_type = IO_NONE; |
363 } else { | 363 } else { |
364 printf("IO port: %s connected to device '%s' with socket name: %s\n", io_name(i), device_type_names[ports[i].device_type], sock_name); | 364 debug_message("IO port: %s connected to device '%s' with socket name: %s\n", io_name(i), device_type_names[ports[i].device_type], sock_name); |
365 ports[i].device.stream.data_fd = -1; | 365 ports[i].device.stream.data_fd = -1; |
366 ports[i].device.stream.listen_fd = socket(AF_UNIX, SOCK_STREAM, 0); | 366 ports[i].device.stream.listen_fd = socket(AF_UNIX, SOCK_STREAM, 0); |
367 size_t pathlen = strlen(sock_name); | 367 size_t pathlen = strlen(sock_name); |
368 size_t addrlen = offsetof(struct sockaddr_un, sun_path) + pathlen + 1; | 368 size_t addrlen = offsetof(struct sockaddr_un, sun_path) + pathlen + 1; |
369 struct sockaddr_un *saddr = malloc(addrlen); | 369 struct sockaddr_un *saddr = malloc(addrlen); |
389 ports[i].device_type = IO_NONE; | 389 ports[i].device_type = IO_NONE; |
390 } | 390 } |
391 } else | 391 } else |
392 #endif | 392 #endif |
393 if (ports[i].device_type == IO_GAMEPAD3 || ports[i].device_type == IO_GAMEPAD6 || ports[i].device_type == IO_GAMEPAD2) { | 393 if (ports[i].device_type == IO_GAMEPAD3 || ports[i].device_type == IO_GAMEPAD6 || ports[i].device_type == IO_GAMEPAD2) { |
394 printf("IO port %s connected to gamepad #%d with type '%s'\n", io_name(i), ports[i].device.pad.gamepad_num, device_type_names[ports[i].device_type]); | 394 debug_message("IO port %s connected to gamepad #%d with type '%s'\n", io_name(i), ports[i].device.pad.gamepad_num, device_type_names[ports[i].device_type]); |
395 } else { | 395 } else { |
396 printf("IO port %s connected to device '%s'\n", io_name(i), device_type_names[ports[i].device_type]); | 396 debug_message("IO port %s connected to device '%s'\n", io_name(i), device_type_names[ports[i].device_type]); |
397 } | 397 } |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 | 401 |
469 #ifndef _WIN32 | 469 #ifndef _WIN32 |
470 static void wait_for_connection(io_port * port) | 470 static void wait_for_connection(io_port * port) |
471 { | 471 { |
472 if (port->device.stream.data_fd == -1) | 472 if (port->device.stream.data_fd == -1) |
473 { | 473 { |
474 puts("Waiting for socket connection..."); | 474 debug_message("Waiting for socket connection..."); |
475 port->device.stream.data_fd = accept(port->device.stream.listen_fd, NULL, NULL); | 475 port->device.stream.data_fd = accept(port->device.stream.listen_fd, NULL, NULL); |
476 fcntl(port->device.stream.data_fd, F_SETFL, O_NONBLOCK | O_RDWR); | 476 fcntl(port->device.stream.data_fd, F_SETFL, O_NONBLOCK | O_RDWR); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |