summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2012-01-24 21:15:31 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2012-01-24 21:15:31 +0100
commit580e920688fb5b6bd4f09ee58de8a48f719cb08a (patch)
tree4800ac17542def9519dd6d9c739c5c4463471937
parent67f9d16884a0da53208c23499e20fe29472099e9 (diff)
downloadbcm4751-580e920688fb5b6bd4f09ee58de8a48f719cb08a.tar.gz
bcm4751-580e920688fb5b6bd4f09ee58de8a48f719cb08a.tar.bz2
bcm4751-580e920688fb5b6bd4f09ee58de8a48f719cb08a.zip
move to blocking read/write
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
-rw-r--r--bcm4751_test.c49
-rwxr-xr-xgps-test-crespobin0 -> 11866 bytes
2 files changed, 14 insertions, 35 deletions
diff --git a/bcm4751_test.c b/bcm4751_test.c
index 55fba55..1752b29 100644
--- a/bcm4751_test.c
+++ b/bcm4751_test.c
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
usleep(250000);
printf("Opening /dev/s3c2410_serial1\n");
- serial_fd = open("/dev/s3c2410_serial1", O_RDWR|O_NOCTTY|O_NONBLOCK);
+ serial_fd = open("/dev/s3c2410_serial1", O_RDWR|O_NOCTTY);
if(serial_fd < 0) {
printf("Serial fd is wrong, aborting\n");
@@ -174,37 +174,23 @@ int main(int argc, char *argv[])
timeout.tv_usec = 0;
printf("Writing init bits\n");
- rc = select(serial_fd + 1, NULL, &fds, NULL, &timeout);
- if(rc > 0) {
- write(serial_fd, init_val, 20);
- printf("Written\n");
- } else {
- printf("Timeout!\n");
- return 0;
- }
+ write(serial_fd, init_val, 20);
+ printf("Written\n");
for(i=0 ; i < 3 ; i++) {
timeout.tv_sec = 1;
timeout.tv_usec = 0;
- rc = select(serial_fd + 1, &fds, NULL, NULL, &timeout);
-
- printf("select rc is %d\n", rc);
-
- if(rc > 0) {
- rc = read(serial_fd, data, 512);
- printf("read %d bytes!\n", rc);
-
- if(rc < 0) {
- wake_unlock("gpsd-interface", 14);
- gpio_write_ascii(gpio_standby_path, "0\n");
- return 0;
- }
+ rc = read(serial_fd, data, 512);
+ printf("read %d bytes!\n", rc);
- hex_dump(data, rc);
- break;
+ if(rc < 0) {
+ wake_unlock("gpsd-interface", 14);
+ gpio_write_ascii(gpio_standby_path, "0\n");
+ return 0;
}
-
+ hex_dump(data, rc);
+ break;
write(serial_fd, init_val, 20);
}
@@ -242,17 +228,10 @@ int main(int argc, char *argv[])
timeout.tv_sec = 1;
timeout.tv_usec = 499000;
- rc = select(serial_fd + 1, &fds, NULL, NULL, &timeout);
-
- printf("select rc is %d\n", rc);
+ rc = read(serial_fd, data, 512);
+ printf("read %d bytes!\n");
+ hex_dump(data, rc);
- if(rc > 0) {
- rc = read(serial_fd, data, 512);
- printf("read %d bytes!\n");
- hex_dump(data, rc);
-
- // usleep(30000);
- }
}
free(data);
diff --git a/gps-test-crespo b/gps-test-crespo
new file mode 100755
index 0000000..74e10e7
--- /dev/null
+++ b/gps-test-crespo
Binary files differ