From 54085f9d3fa0c1b1eeb3a82a0c4a6e3400d9961c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 19 Feb 2011 12:56:06 +0800 Subject: [PATCH] Reset slot names on startup --- src/server/handler_coke.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/server/handler_coke.c b/src/server/handler_coke.c index decdf4d..ee7b869 100644 --- a/src/server/handler_coke.c +++ b/src/server/handler_coke.c @@ -50,6 +50,24 @@ int Coke_InitHandler() if( giCoke_SerialFD == -1 ) { fprintf(stderr, "ERROR: Unable to open coke serial port ('%s')\n", gsCoke_SerialPort); } + else { + // Reset the slot names. + // - Dunno why this is needed, but the machine plays silly + // sometimes. + write(giCoke_SerialFD, "n0 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n1 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n2 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n3 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n4 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n5 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n6 Coke\n", 8); + } CompileRegex(&gCoke_StatusRegex, "^slot\\s+([0-9]+)\\s+([^:]+):([a-zA-Z]+)\\s*", REG_EXTENDED); return 0; -- 2.20.1