diff options
author | Julian Oes <julian@oes.ch> | 2013-09-22 17:23:43 +0200 |
---|---|---|
committer | Julian Oes <julian@oes.ch> | 2013-09-22 17:23:43 +0200 |
commit | 166dba09de38642ec656d857e225c08d9a36fc72 (patch) | |
tree | 109065accfe63a5e788a30fa08852532d528b2f6 /src/drivers/px4io | |
parent | 07f82efe9b33d27fafa08d712243ce02c360e8fa (diff) | |
download | px4-firmware-166dba09de38642ec656d857e225c08d9a36fc72.tar.gz px4-firmware-166dba09de38642ec656d857e225c08d9a36fc72.tar.bz2 px4-firmware-166dba09de38642ec656d857e225c08d9a36fc72.zip |
px4io test and fmu test now work over USB as well
Diffstat (limited to 'src/drivers/px4io')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 952453a8c..133646051 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -2131,10 +2131,9 @@ test(void) if (ioctl(fd, PWM_SERVO_ARM, 0)) err(1, "failed to arm servos"); - /* Open console directly to grab CTRL-C signal */ - int console = open("/dev/console", O_NONBLOCK | O_RDONLY | O_NOCTTY); - if (!console) - err(1, "failed opening console"); + struct pollfd fds; + fds.fd = 0; /* stdin */ + fds.events = POLLIN; warnx("Press CTRL-C or 'c' to abort."); @@ -2175,10 +2174,12 @@ test(void) /* Check if user wants to quit */ char c; - if (read(console, &c, 1) == 1) { + ret = poll(&fds, 1, 0); + if (ret > 0) { + + read(0, &c, 1); if (c == 0x03 || c == 0x63 || c == 'q') { warnx("User abort\n"); - close(console); exit(0); } } |