X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fserver%2Fhandler_door.c;fp=src%2Fserver%2Fhandler_door.c;h=90c65fb501bc69cec575e25f5dc2dd22726a150a;hb=acefc1cf9f43910ba501332f560fbf3bddec01c9;hp=163ed3c761dae69859eab6c3017a6e333b2e17aa;hpb=dcf0829fa7f8d04571d84e4d89fd87328bb1aa5b;p=tpg%2Fopendispense2.git diff --git a/src/server/handler_door.c b/src/server/handler_door.c index 163ed3c..90c65fb 100644 --- a/src/server/handler_door.c +++ b/src/server/handler_door.c @@ -104,11 +104,15 @@ int Door_DoDispense(int User, int Item) { struct termios info; tcgetattr(door_serial_handle, &info); - info.c_iflag &= ~IGNCR; // Ignore \r +// info.c_iflag &= ~IGNCR; // Ignore \r + info.c_cflag &= ~CLOCAL; tcsetattr(door_serial_handle, TCSANOW, &info); } - if( writes(door_serial_handle, "\r\nATH1\r\n") ) { + 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"); return -1; @@ -117,7 +121,7 @@ int Door_DoDispense(int User, int Item) // Wait before re-locking sleep(DOOR_UNLOCKED_DELAY); - if( writes(door_serial_handle, "\r\nATH0\r\n") ) { + if( writes(door_serial_handle, "ATH0\r") ) { fprintf(stderr, "Oh, hell! Door not re-locking, big error (sending ATH0 failed)\n"); perror("Sending ATH0"); return -1;