- if( read_child_output() ) return -1;
-
- // Send password
- if( giDoor_ChildStatus || fputs(gsDoor_Password, child_stdin) <= 0 ) {
- printf("Door_DoDispense: fputs password fail\n");
- return -1;
- }
- fputs("\n", child_stdin);
- fflush(child_stdin);
-
- if( read_child_output() ) return -1;
-
- #if DEBUG
- printf("Door_DoDispense: Door unlock\n");
- #endif
- // ATH1 - Unlock door
- if( giDoor_ChildStatus || fputs("ATH1\n", child_stdin) == 0) {
- #if DEBUG
- printf("Door_DoDispense: fputs unlock failed (or child terminated)\n");
- #endif
- return -1;
- }
- fflush(child_stdin);
-
- // Wait before re-locking
- sleep(DOOR_UNLOCKED_DELAY);