- // llogin or other
- pipe = popen("llogin door -w -", "w");
- if( !pipe || pipe == (void*)-1 ) {
- #if DEBUG
- printf("Door_DoDispense: llogin failure\n");
- #endif
+ door_serial_handle = InitSerial(gsDoor_SerialPort, 1200);
+ if(door_serial_handle < 0) {
+ fprintf(stderr, "Unable to open door serial '%s'\n", gsDoor_SerialPort);
+ perror("Opening door port");
+ return -1;
+ }
+
+ {
+ struct termios info;
+ tcgetattr(door_serial_handle, &info);
+// info.c_iflag &= ~IGNCR; // Ignore \r
+ info.c_cflag &= ~CLOCAL;
+ tcsetattr(door_serial_handle, TCSANOW, &info);
+ }
+
+ writes(door_serial_handle, "\r\r");
+ sleep(1);
+
+ if( writes(door_serial_handle, "ATH1\r") ) {
+ fprintf(stderr, "Unable to open door (sending ATH1)\n");
+ perror("Sending ATH1");