Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_implicit_flush(true);
- $cmd = "/home/pi/projects/PingPongSet/enroll";
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
- 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
- 2 => array("pipe", "w") // stderr is a pipe that the child will write to
- );
- flush();
- $process = proc_open($cmd, $descriptorspec, $pipes);
- echo 'opened'."n";
- if (is_resource($process)) {
- sleep(1);
- echo "blahn";
- var_export(fgets($pipes[1]));
- echo "blah213n";
- while ($s = fgets($pipes[1])) {
- print $s;
- flush();
- }
- }
- struct fp_print_data *enroll(struct fp_dev *dev) {
- struct fp_print_data *enrolled_print = NULL;
- int r;
- do {
- struct fp_img *img = NULL;
- sleep(1);
- printf("nScan your finger now.n");
- r = fp_enroll_finger_img(dev, &enrolled_print, &img);
- printf("nFinger scanned.n");
- if (img) {
- fp_img_save_to_file(img, "enrolled.pgm");
- printf("Wrote scanned image to enrolled.pgmn");
- fp_img_free(img);
- }
- if (r < 0) {
- printf("Enroll failed with error %dn", r);
- play_error();
- return NULL;
- }
- switch (r) {
- case FP_ENROLL_COMPLETE:
- printf("Enroll complete!n");
- break;
- case FP_ENROLL_FAIL:
- printf("Enroll failed, something wen't wrong :(n");
- play_error();
- return NULL;
- case FP_ENROLL_PASS:
- printf("Enroll stage passed. Yay!n");
- play_success();
- break;
- case FP_ENROLL_RETRY:
- printf("Didn't quite catch that. Please try again.n");
- play_error();
- break;
- case FP_ENROLL_RETRY_TOO_SHORT:
- printf("Your swipe was too short, please try again.n");
- play_error();
- break;
- case FP_ENROLL_RETRY_CENTER_FINGER:
- printf("Didn't catch that, please center your finger on the "
- "sensor and try again.n");
- play_error();
- break;
- case FP_ENROLL_RETRY_REMOVE_FINGER:
- printf("Scan failed, please remove your finger and then try "
- "again.n");
- play_error();
- break;
- }
- } while (r != FP_ENROLL_COMPLETE);
- if (!enrolled_print) {
- fprintf(stderr, "Enroll complete but no print?n");
- return NULL;
- }
- printf("Enrollment completed!nn");
- play_success();
- return enrolled_print;
- }
- opened
- blah
- -----NOTE: THE STUFF BELOW HERE DOESN'T DISPLAY UNTIL AFTER enroll TERMINATES-----
- 'Found device claimed by Digital Persona U.are.U 4000/4000B/4500 driver
- 'blah213
- Opened device. It's now time to enroll your finger.
- Scan your finger now.
- uru4000:info [init_run_state] Versions 0040 and 0014
- Finger scanned.
- Wrote scanned image to enrolled.pgm
- Enroll stage passed. Yay!
- Scan your finger now.
- Finger scanned.
- Wrote scanned image to enrolled.pgm
- Enroll stage passed. Yay!
- Scan your finger now.
- Finger scanned.
- Wrote scanned image to enrolled.pgm
- Enroll stage passed. Yay!
- Scan your finger now.
- Finger scanned.
- Wrote scanned image to enrolled.pgm
- Enroll stage passed. Yay!
- Scan your finger now.
- Finger scanned.
- Wrote scanned image to enrolled.pgm
- Enroll complete!
- Enrollment completed!
- Closing device
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement