+ if( !(Bank_GetFlags(User) & USER_FLAG_DOORGROUP) )
+ {
+ #if DEBUG
+ printf("Door_CanDispense: User %i not in door\n", User);
+ #endif
+ return 1;
+ }
+
+ door_serial_handle = InitSerial(gsDoor_SerialPort, 115200);
+ if(door_serial_handle < 0) {
+ fprintf(stderr, "Unable to open door serial '%s'\n", gsDoor_SerialPort);
+ perror("Opening door port");
+ return -1;
+ }
+
+ // Disable local echo
+ {
+ struct termios info;
+ tcgetattr(door_serial_handle, &info);
+ info.c_cflag &= ~CLOCAL;
+ tcsetattr(door_serial_handle, TCSANOW, &info);
+ }
+
+// flush(door_serial_handle);
+
+ writes(door_serial_handle, "4;");
+
+#if 0
+ char *status = ReadStatus(door_serial_handle);
+ if( !status ) return -1;
+ if( strcmp(status, "Opening door") != 0 ) {
+ fprintf(stderr, "Unknown/unexpected door status '%s'\n", status);
+ return -1;
+ }
+#endif
+
+ close(door_serial_handle);