git.ucc.asn.au
/
tpg
/
opendispense2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Untested fix to coke code (flushes buffer beofre reading)
[tpg/opendispense2.git]
/
src
/
server
/
handler_coke.c
diff --git
a/src/server/handler_coke.c
b/src/server/handler_coke.c
index
5dc4a35
..
a6b3cb9
100644
(file)
--- a/
src/server/handler_coke.c
+++ b/
src/server/handler_coke.c
@@
-65,6
+65,12
@@
int Coke_CanDispense(int UNUSED(User), int Item)
if( giCoke_SerialFD == -1 )
return -2;
if( giCoke_SerialFD == -1 )
return -2;
+ // Flush the input buffer
+ {
+ char tmpbuf[512];
+ read(giCoke_SerialFD, tmpbuf, sizeof(tmpbuf));
+ }
+
// Wait for a prompt
ret = 0;
do {
// Wait for a prompt
ret = 0;
do {
@@
-134,6
+140,12
@@
int Coke_DoDispense(int UNUSED(User), int Item)
// Can't dispense if the machine is not connected
if( giCoke_SerialFD == -1 )
return -2;
// Can't dispense if the machine is not connected
if( giCoke_SerialFD == -1 )
return -2;
+
+ // Flush the input buffer
+ {
+ char tmpbuf[512];
+ read(giCoke_SerialFD, tmpbuf, sizeof(tmpbuf));
+ }
// Wait for prompt
i = 0;
// Wait for prompt
i = 0;
UCC
git Repository :: git.ucc.asn.au