| static int connect_to_console(void) |
| port = adb_get_emulator_console_port(); |
| fprintf(stderr, "error: more than one emulator detected. use -s option\n"); |
| fprintf(stderr, "error: no emulator detected\n"); |
| fd = socket_loopback_client( port, SOCK_STREAM ); |
| fprintf(stderr, "error: could not connect to TCP port %d\n", port); |
| int adb_send_emulator_command(int argc, char** argv) |
| fd = connect_to_console(); |
| for (nn = 1; nn < argc; nn++) { |
| adb_write( fd, argv[nn], strlen(argv[nn]) ); |
| adb_write( fd, (nn == argc-1) ? "\n" : " ", 1 ); |
| adb_write( fd, QUIT, sizeof(QUIT)-1 ); |